* @copyright 2021 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ abstract class RetailcrmAbstractDataBuilder { /** * @var mixed Any data type (depends on the builder) */ protected $data; /** * RetailcrmAddressBuilder constructor. */ public function __construct() { $this->reset(); } /** * Reset builder state * * @return $this */ public function reset() { $this->data = null; return $this; } /** * Return cleared built data casted to array * * @return array */ public function getDataArray() { if (is_array($this->data)) { return RetailcrmTools::clearArray((array) $this->data); } return []; } /** * Returns built data casted to string * * @return string */ public function getDataString() { if (is_string($this->data)) { return (string) $this->data; } return ''; } /** * Return builder data without any type-casting * * @return mixed */ public function getData() { return $this->data; } /** * Build data * * @return $this */ abstract public function build(); }