setName($name); $this->setInn($inn); $this->setAddress($address); $this->setPhones($phones); } /** * Возвращает установленное наименование поставщика * * @return string|null */ public function getName(): ?string { return $this->name; } /** * Устанавливает наименование поставщика * * @param string|null $name * @return $this */ public function setName(?string $name): self { // критерии валидной строки не описаны ни в схеме, ни в документации $this->name = trim((string)$name) ?: null; return $this; } /** * Возвращает установленный адрес места расчётов * * @return string|null */ public function getAddress(): ?string { return $this->address; } /** * Устанавливает адрес места расчётов * * @param string|null $address * @return $this */ public function setAddress(?string $address): self { // критерии валидной строки не описаны ни в схеме, ни в документации $this->address = trim((string)$address) ?: null; return $this; } /** * @inheritDoc */ public function jsonSerialize(): array { $json = []; $this->getName() && $json['name'] = $this->getName(); $this->getInn() && $json['inn'] = $this->getInn(); $this->getAddress() && $json['address'] = $this->getAddress(); !$this->getPhones()->isEmpty() && $json['phones'] = $this->getPhones()->toArray(); return $json; } }