/** * ClientAbstract constructor. * * @param StoreAbstract $store * @param array|null $data */ public function __construct(StoreAbstract $store, $data = null) { parent::__construct(); $this->store = $store; if (!is_array($data) && !empty($data) && !$this->isId($data)) { $exceptionClass = $this::EXCEPTION_CLASS; throw new $exceptionClass('Wrong format of specified data'); } if ($this->isId($data)) { $this->id = $data; return; } if (is_array($data) || empty($data)) { $entity = $this->makeEntity($data); $this->id = $entity->getId(); } }
/** * * @param Store $store * @throws PromiseException */ public function __construct(Store $store) { parent::__construct(); $this->store = $store; }