1 | <?php |
||
16 | class Schema extends AbstractModel implements Arrayable { |
||
17 | |||
18 | use RefPart; |
||
19 | use TypePart; |
||
20 | use DescriptionPart; |
||
21 | use ItemsPart; |
||
22 | use ExternalDocsPart; |
||
23 | use ExtensionPart; |
||
24 | |||
25 | /** @var string */ |
||
26 | private $discriminator; |
||
27 | |||
28 | /** @var bool */ |
||
29 | private $readOnly = false; |
||
30 | |||
31 | /** @var string */ |
||
32 | private $title; |
||
33 | |||
34 | private $xml; |
||
|
|||
35 | |||
36 | /** @var string */ |
||
37 | private $example; |
||
38 | |||
39 | /** @var ArrayList|bool */ |
||
40 | private $required; |
||
41 | |||
42 | /** @var Definitions */ |
||
43 | private $properties; |
||
44 | |||
45 | /** @var ArrayList */ |
||
46 | private $allOf; |
||
47 | |||
48 | /** @var Schema */ |
||
49 | private $additionalProperties; |
||
50 | |||
51 | 9 | public function __construct($contents = null) { |
|
54 | |||
55 | 9 | private function parse($contents = []) { |
|
56 | 9 | $data = CollectionUtils::toMap($contents); |
|
57 | |||
58 | 9 | $this->title = $data->get('title'); |
|
59 | 9 | $this->discriminator = $data->get('discriminator'); |
|
60 | 9 | $this->readOnly = $data->has('readOnly') && $data->get('readOnly'); |
|
61 | 9 | $this->example = $data->get('example'); |
|
62 | 9 | $this->required = $data->get('required'); |
|
63 | 9 | $this->properties = new Definitions($data->get('properties')); |
|
64 | 9 | if ($data->has('additionalProperties')) { |
|
65 | $this->additionalProperties = new self($data->get('additionalProperties')); |
||
66 | } |
||
67 | |||
68 | 9 | $this->allOf = new ArrayList(); |
|
69 | 9 | if ($data->has('allOf')) { |
|
70 | 3 | foreach ($data->get('allOf') as $schema) { |
|
71 | 3 | $this->allOf->add(new self($schema)); |
|
72 | } |
||
73 | } |
||
74 | |||
75 | // parts |
||
76 | 9 | $this->parseRef($data); |
|
77 | 9 | $this->parseType($data); |
|
78 | 9 | $this->parseDescription($data); |
|
79 | 9 | $this->parseItems($data); |
|
80 | 9 | $this->parseExternalDocs($data); |
|
81 | 9 | $this->parseExtensions($data); |
|
82 | 9 | } |
|
83 | |||
84 | 9 | public function toArray() { |
|
89 | |||
90 | /** |
||
91 | * |
||
92 | * @return bool|array |
||
93 | */ |
||
94 | public function getRequired() { |
||
97 | |||
98 | /** |
||
99 | * |
||
100 | * @param bool|array $required |
||
101 | * @return $this |
||
102 | */ |
||
103 | public function setRequired($required) { |
||
107 | |||
108 | /** |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getDiscriminator() { |
||
115 | |||
116 | /** |
||
117 | * |
||
118 | * @param string $discriminator |
||
119 | */ |
||
120 | public function setDiscriminator($discriminator) { |
||
124 | |||
125 | /** |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function isReadOnly() { |
||
132 | |||
133 | /** |
||
134 | * |
||
135 | * @param bool $readOnly |
||
136 | */ |
||
137 | public function setReadOnly($readOnly) { |
||
141 | |||
142 | /** |
||
143 | * |
||
144 | * @return string |
||
145 | */ |
||
146 | public function getExample() { |
||
149 | |||
150 | /** |
||
151 | * |
||
152 | * @param string $example |
||
153 | */ |
||
154 | public function setExample($example) { |
||
158 | |||
159 | /** |
||
160 | * |
||
161 | * @return string |
||
162 | */ |
||
163 | public function getTitle() { |
||
166 | |||
167 | /** |
||
168 | * |
||
169 | * @param string $title |
||
170 | * @return $this |
||
171 | */ |
||
172 | public function setTitle($title) { |
||
176 | |||
177 | /** |
||
178 | * |
||
179 | * @return Definitions |
||
180 | */ |
||
181 | public function getProperties() { |
||
184 | |||
185 | /** |
||
186 | * |
||
187 | * @return ArrayList |
||
188 | */ |
||
189 | public function getAllOf() { |
||
192 | |||
193 | /** |
||
194 | * |
||
195 | * @return Schema |
||
196 | */ |
||
197 | public function getAdditionalProperties() { |
||
203 | |||
204 | } |
||
205 |
This check marks private properties in classes that are never used. Those properties can be removed.