@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | */ |
15 | 15 | private static function searchPayloadParam($params, $variable) { |
16 | 16 | $exists = false; |
17 | - if(null !== $params && count($params)) { |
|
18 | - foreach($params as $param) { |
|
19 | - if($param['name'] === $variable) { |
|
17 | + if (null !== $params && count($params)) { |
|
18 | + foreach ($params as $param) { |
|
19 | + if ($param['name'] === $variable) { |
|
20 | 20 | $exists = true; |
21 | 21 | break; |
22 | 22 | } |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | ]; |
41 | 41 | if ($endpoint['payload']['is_array']) { |
42 | 42 | $schema['items'] = [ |
43 | - '$ref' => '#/definitions/' . $endpoint['payload']['type'], |
|
43 | + '$ref' => '#/definitions/'.$endpoint['payload']['type'], |
|
44 | 44 | ]; |
45 | - } else { |
|
46 | - $schema['$ref'] = '#/definitions/' . $endpoint['payload']['type']; |
|
45 | + }else { |
|
46 | + $schema['$ref'] = '#/definitions/'.$endpoint['payload']['type']; |
|
47 | 47 | } |
48 | - if(!self::searchPayloadParam($paths[$url][$method]['parameters'], $endpoint['payload']['type'])) { |
|
48 | + if (!self::searchPayloadParam($paths[$url][$method]['parameters'], $endpoint['payload']['type'])) { |
|
49 | 49 | $paths[$url][$method]['parameters'][] = [ |
50 | 50 | 'in' => 'body', |
51 | 51 | 'name' => $endpoint['payload']['type'], |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | if (array_key_exists('data', $endpoint['return']) && count(array_keys($object)) === count(array_keys($endpoint['return']['data']))) { |
75 | 75 | $classDefinition = [ |
76 | 76 | 'type' => 'object', |
77 | - '$ref' => '#/definitions/' . $class, |
|
77 | + '$ref' => '#/definitions/'.$class, |
|
78 | 78 | ]; |
79 | - } else { |
|
79 | + }else { |
|
80 | 80 | $classDefinition = [ |
81 | 81 | 'type' => 'array', |
82 | 82 | 'items' => [ |
83 | - '$ref' => '#/definitions/' . $class, |
|
83 | + '$ref' => '#/definitions/'.$class, |
|
84 | 84 | ], |
85 | 85 | ]; |
86 | 86 | } |
87 | 87 | |
88 | - if($paths[$url][$method]['responses'][200]['schema']['properties']['data']['type'] === 'boolean') { |
|
88 | + if ($paths[$url][$method]['responses'][200]['schema']['properties']['data']['type'] === 'boolean') { |
|
89 | 89 | $paths[$url][$method]['responses'][200]['schema']['properties']['data'] = $classDefinition; |
90 | 90 | } |
91 | 91 | $dtos += self::extractSwaggerDefinition($class, $object); |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | ], |
164 | 164 | ]; |
165 | 165 | foreach ($fields as $field => $info) { |
166 | - if(array_key_exists('type', $info) || in_array($info['type'], ['array', 'object'])) { |
|
166 | + if (array_key_exists('type', $info) || in_array($info['type'], ['array', 'object'])) { |
|
167 | 167 | $definition[$name]['properties'][$field] = $info; |
168 | - } else { |
|
168 | + }else { |
|
169 | 169 | list($type, $format) = self::translateSwaggerFormats($info['type']); |
170 | 170 | $fieldData = [ |
171 | 171 | "type" => $type, |
172 | 172 | "required" => $info['required'], |
173 | 173 | ]; |
174 | - if(array_key_exists('description', $info)) { |
|
174 | + if (array_key_exists('description', $info)) { |
|
175 | 175 | $fieldData['description'] = $info['description']; |
176 | 176 | } |
177 | - if(array_key_exists('format', $info)) { |
|
177 | + if (array_key_exists('format', $info)) { |
|
178 | 178 | $fieldData['format'] = $info['format']; |
179 | 179 | } |
180 | 180 | $dto['properties'][$field] = $fieldData; |