* @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:----s2OCGOykv5yrnI65SWQopvx7SUyi/SJGMHSpfQJ7Sod5doRCu3ZEM4Tyuq7WzBtz7Kaq9aRjoL6YiDNcr35tGUPiaje0G/8EMVh27P4SKrxWxS+CMsvqgdQ4tkl2m2vVwooihFfLIGpOQyA6cJFv3P+P8kUGghMoX6H8BwIKHgVHCtftzu2AAOtb5ZcnxKJMJiVhUv3cQJs/DLwsNS78RWyIPc12W76URpxlSIQcnR4PNeqUFjkwXMSuR6e4NlEJrKq7U1FutjxSIJ6jytHM0jq9vNl4fsdULGznkc1LQTlQm/47yJWL05sEP+dYXv3SKE6+adGmGkVbOoEHqwo4QGMy2k6p0AOpUTnsZHPdKlC/YAEXnfZqkYEXrtjSvirBSpR0YHuyUfwEo8W0a0Zu2GkAvhS/UwantqZIAcsXej3XzJXRYjeBHUd8HEw2TMc6hXgSEXxYzJAmAFtSEjpylM0+tcEUi2WnCgJH+72EMef+XIcGuHssGCJhuSUq0bIV+KAMTum26kRo1tjsrCKUFEyxvbCxKJENOn0zT7XN2l7LmUiSDyQuGVH69OZ3dgfgneKYH6UBkjeywHb4ha5r+Kfhl3847IFwDI5fmJ3O62/4OfTSG1DgX89UPJ2s2MMUDivGjVC1S8qqQYjxGoiMlZjGEG8oNZLNrtH9720eUCY=----ATTACHMENT:----NzkxMzMyMjkyMjk3Njc1OSAxMzMzNDE0MjE1NjIzNzQgNjU3Mjg2NTU0NDM5OTgyOA==