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 boolean */ |
||
29 | private $readOnly = false; |
||
30 | |||
31 | /** @var string */ |
||
32 | private $title; |
||
33 | |||
34 | |||
35 | private $xml; |
||
|
|||
36 | |||
37 | /** @var string */ |
||
38 | private $example; |
||
39 | |||
40 | /** @var ArrayList|boolean */ |
||
41 | private $required; |
||
42 | |||
43 | /** @var Definitions */ |
||
44 | private $properties; |
||
45 | |||
46 | /** @var ArrayList */ |
||
47 | private $allOf; |
||
48 | |||
49 | /** @var Schema */ |
||
50 | private $additionalProperties; |
||
51 | |||
52 | 9 | public function __construct($contents = null) { |
|
55 | |||
56 | 9 | private function parse($contents = []) { |
|
57 | 9 | $data = CollectionUtils::toMap($contents); |
|
58 | |||
59 | 9 | $this->title = $data->get('title'); |
|
60 | 9 | $this->discriminator = $data->get('discriminator'); |
|
61 | 9 | $this->readOnly = $data->has('readOnly') && $data->get('readOnly'); |
|
62 | 9 | $this->example = $data->get('example'); |
|
63 | 9 | $this->required = $data->get('required'); |
|
64 | 9 | $this->properties = new Definitions($data->get('properties')); |
|
65 | 9 | if ($data->has('additionalProperties')) { |
|
66 | $this->additionalProperties = new Schema($data->get('additionalProperties')); |
||
67 | } |
||
68 | |||
69 | 9 | $this->allOf = new ArrayList(); |
|
70 | 9 | if ($data->has('allOf')) { |
|
71 | 3 | foreach ($data->get('allOf') as $schema) { |
|
72 | 3 | $this->allOf->add(new Schema($schema)); |
|
73 | 3 | } |
|
74 | 3 | } |
|
75 | |||
76 | // parts |
||
77 | 9 | $this->parseRef($data); |
|
78 | 9 | $this->parseType($data); |
|
79 | 9 | $this->parseDescription($data); |
|
80 | 9 | $this->parseItems($data); |
|
81 | 9 | $this->parseExternalDocs($data); |
|
82 | 9 | $this->parseExtensions($data); |
|
83 | 9 | } |
|
84 | |||
85 | 6 | public function toArray() { |
|
86 | 6 | return $this->export('title', 'discriminator', 'description', 'readOnly', 'example', |
|
87 | 6 | 'externalDocs', $this->getTypeExportFields(), 'items', 'required', |
|
88 | 6 | 'properties', 'additionalProperties', 'allOf'); |
|
89 | } |
||
90 | |||
91 | /** |
||
92 | * |
||
93 | * @return boolean|array |
||
94 | */ |
||
95 | public function getRequired() { |
||
98 | |||
99 | /** |
||
100 | * |
||
101 | * @param boolean|array $required |
||
102 | * @return $this |
||
103 | */ |
||
104 | public function setRequired($required) { |
||
108 | |||
109 | /** |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | public function getDiscriminator() { |
||
116 | |||
117 | /** |
||
118 | * |
||
119 | * @param string $discriminator |
||
120 | */ |
||
121 | public function setDiscriminator($discriminator) { |
||
125 | |||
126 | /** |
||
127 | * |
||
128 | * @return boolean |
||
129 | */ |
||
130 | public function isReadOnly() { |
||
133 | |||
134 | /** |
||
135 | * |
||
136 | * @param boolean $readOnly |
||
137 | */ |
||
138 | public function setReadOnly($readOnly) { |
||
142 | |||
143 | /** |
||
144 | * |
||
145 | * @return string |
||
146 | */ |
||
147 | public function getExample() { |
||
150 | |||
151 | /** |
||
152 | * |
||
153 | * @param string $example |
||
154 | */ |
||
155 | public function setExample($example) { |
||
159 | |||
160 | /** |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | public function getTitle() { |
||
167 | |||
168 | /** |
||
169 | * |
||
170 | * @param string $title |
||
171 | * @return $this |
||
172 | */ |
||
173 | public function setTitle($title) { |
||
177 | |||
178 | /** |
||
179 | * |
||
180 | * @return Definitions |
||
181 | */ |
||
182 | public function getProperties() { |
||
185 | |||
186 | /** |
||
187 | * |
||
188 | * @return ArrayList |
||
189 | */ |
||
190 | public function getAllOf() { |
||
193 | |||
194 | /** |
||
195 | * |
||
196 | * @return Schema |
||
197 | */ |
||
198 | public function getAdditionalProperties() { |
||
204 | |||
205 | } |
This check marks private properties in classes that are never used. Those properties can be removed.