* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class StructType extends ObjectType { /** @var string */ protected $extends; /** @var array */ protected $properties; /** @var array */ protected $required; /** * @return string */ public function getExtends(): ?string { return $this->extends; } /** * @param string $extends */ public function setExtends(string $extends): void { $this->extends = $extends; } /** * @return array */ public function getProperties(): ?array { return $this->properties; } /** * @param array $properties * @return self * @throws InvalidSchemaException */ public function setProperties(array $properties): self { $this->properties = []; foreach ($properties as $name => $property) { $this->addProperty($name, $property); } return $this; } /** * @param string $name * @param \PSX\Schema\TypeInterface $property * @return self * @throws InvalidSchemaException */ public function addProperty(string $name, TypeInterface $property): self { TypeAssert::assertProperty($property); $this->properties[$name] = $property; return $this; } /** * @param string $name * @return \PSX\Schema\TypeInterface */ public function getProperty(string $name): ?TypeInterface { return $this->properties[$name] ?? null; } /** * @param string $name * @return boolean */ public function hasProperty(string $name): bool { return isset($this->properties[$name]); } /** * @param string $name * @return self */ public function removeProperty(string $name): self { if (isset($this->properties[$name])) { unset($this->properties[$name]); } return $this; } /** * @return array */ public function getRequired(): ?array { return $this->required; } /** * @param array $required * @return self */ public function setRequired(array $required): self { $this->required = $required; return $this; } public function toArray(): array { return array_merge(parent::toArray(), array_filter([ '$extends' => $this->extends, 'type' => 'object', 'properties' => $this->properties, 'required' => $this->required, ], function($value){ return $value !== null; })); } public function __clone() { if ($this->properties !== null) { $properties = $this->properties; $this->properties = []; foreach ($properties as $name => $property) { $this->properties[$name] = clone $property; } } } } __halt_compiler();----SIGNATURE:----ebTdvXBDR2yOXNz7v2oJ+J2cO1P4LBwurBGDxf6ShnEDaUMfkwfU+G+Y5LEXry/GriRJswB7s3Xr9ksKvl3vRINCGBE6ZP2uuyJ1eVRhR7Uxs2R+N4VOaAvbiZlQfOFT56btN/zKq4RJgPc/qFArSB3BfptbHsqMQxBq8Sxb4k54MleTrDUZ9ojnZRzULOGQZ/uwKXJsBhEcN6vAAc75C7Gje8lX5uixebPewbW77ciB2O7C9AGrhjPvRJ5i7mTF+meWE8xWhmzOVxcinOMSijZr1lyUUMxH5fvBlVNDGeT9i7FhognhUnmiYAzGCcubAoI3HnepLu3OncTF9n+yiqqB8gsDnbhvlgJBGfvzb2WoW8ehgcVMek6fA84VRPeaQqjcu2W00o3MWVhnYL2RpnsuZi5pcK7fgmM2CiOH2CQljrj8o0Euc1FAh1e3fIrfeOTkzZvy6MEAvuw+bSmWFRP2jzd6apqMAv6uBcfdXKOGiZDdaVzdhAObn6S8FcfwFzdS+YMQAtkqJqhyf4+vlwPSXmiDVEOqE6glQ1N+ruzzZYs4JbRrxEO6Awr3FugFDKQ3YQvT5p/VjOWY1YK3haP70rznntBgwyF3jIO4PKYAMNDJmTQjOGZ9/Hv42/0Yz+gf7ykeOpjNoBvMGPybH3NS56PmKFOfZe47UPmbzk0=----ATTACHMENT:----ODcwNTQxNDYwMDM1NDE4MCAxMzcxMjU3Nzc0ODAyMzIyIDQ1MjMyODE1NTc4NzIxODg=