* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Type implements \JsonSerializable { public const TYPE_OBJECT = 'object'; public const TYPE_MAP = 'map'; public const TYPE_REFERENCE = 'reference'; private $name; private $type; private $description; private $parent; private $ref; private $template; /** @var Property[] */ private $properties; public function __construct(array $entity) { $this->name = $entity['name'] ?? null; $this->type = $entity['type'] ?? null; $this->description = $entity['description'] ?? null; $this->parent = $entity['parent'] ?? null; $this->ref = $entity['ref'] ?? null; $this->template = $entity['template'] ?? null; $this->properties = $this->convertProperties($entity['properties']); } public function getName(): ?string { return $this->name; } public function getType(): ?string { return $this->type; } public function getDescription(): ?string { return $this->description; } public function getParent(): ?string { return $this->parent; } public function getRef(): ?string { return $this->ref; } public function getTemplate(): ?string { return $this->template; } /** * @return Property[] */ public function getProperties(): array { return $this->properties; } public function getProperty(int $index): ?Property { return $this->properties[$index] ?? null; } public function indexOf(string $propertyName): ?int { foreach ($this->properties as $index => $property) { if ($property->getName() === $propertyName) { return $index; } } return null; } public function jsonSerialize() { return [ 'name' => $this->name, 'description' => $this->description, 'parent' => $this->parent, 'ref' => $this->ref, 'template' => $this->template, 'properties' => $this->properties, ]; } private function convertProperties(array $properties): array { $result = []; foreach ($properties as $property) { if ($property instanceof \stdClass) { $result[] = new Property((array) $property); } elseif (is_array($property)) { $result[] = new Property($property); } } return $result; } } __halt_compiler();----SIGNATURE:----qSxrL7w9X4L3qICp7u5xe7vKveUxOZzYi1aFiCPOytEhCDoMU23FE2JRhAD0pghV18hRdQYr1teb2hiDV/AmaNKMU2m/LKF5pc1dqQpuB23zCAS4e9h0U8hnlIRIlsDgiMVpdVOz900ebZVxhCK6Ajr3GuIpuJZKsrIT7balZMPqe1tW4EQMP95KQ47UhYi/5gfL2nnbpfX9XwPBTMiZS7HVKcjj+y7kEB6jQsHL87lzE6/+XRCeNqiirNrSqBXghO04Mt5SzRqNEjvIBhX5DGA4nJtH53B9wU7QaJHu40cfFYzQON8HHkkWiPXT2jDOGXLvPzICeGgOLrqjU6NwAqhPh5HQWXr0hT1JZrlYNOu0CKApsMBQ/nk9aKFrlX82MSssBHvNZc2gaG8dF8kjHyfs8r/U6sCocTApSq4SdS2Qi65V5qevDMR8cy3z60vXIbnyoxyrGCMEVk6/ZYp07EubuYaO5QlYY84dQNfwHpIZ3A5lzE73xpKWJStJS+GmfE8UxPgN0fc9MaSuU6/8wd9XyWL3d7ccyUG3JHbvwWgMH0fGfzJt6AvRNZFmCYZ8/A1dnYL0NQVsmL0urcjkFV1RBvOMyHGeLklMGNqd/nypLxndIIJGFYfh9R3R7wRChG0uemN7lDVdBYkJ+mkUwZWS3/Rpuz5ZWi/56CX7XEU=----ATTACHMENT:----ODg3ODAxMzU1ODQ4ODA0MiAyMDQyMjEzNTQ4ODQ1MjY1IDc2ODQ3NDc2MzcxNjYyMDU=