@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -spl_autoload_register(function ($classname) { |
|
3 | +spl_autoload_register(function($classname) { |
|
4 | 4 | $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php'; |
5 | 5 | if (is_file($file)) { |
6 | 6 | require_once $file; |
@@ -240,7 +240,7 @@ |
||
240 | 240 | * @covers \SwaggerGen\Swagger\Operation::handleCommand |
241 | 241 | */ |
242 | 242 | public function testHandleCommand_OperationId_UniqueInSwagger() |
243 | - { |
|
243 | + { |
|
244 | 244 | // First occurance |
245 | 245 | $path = $this->parent->handleCommand('endpoint', 'foo'); |
246 | 246 | $this->assertInstanceOf('\SwaggerGen\Swagger\Path', $path); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | 'responses' => array( |
724 | 724 | 200 => array( |
725 | 725 | 'description' => 'OK', |
726 | - 'schema' => Array( |
|
726 | + 'schema' => array( |
|
727 | 727 | 'type' => 'integer', |
728 | 728 | 'format' => 'int32', |
729 | 729 | ), |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | 'responses' => array( |
748 | 748 | 200 => array( |
749 | 749 | 'description' => 'Stuff is returned', |
750 | - 'schema' => Array( |
|
750 | + 'schema' => array( |
|
751 | 751 | 'type' => 'integer', |
752 | 752 | 'format' => 'int32', |
753 | 753 | ), |
@@ -337,23 +337,23 @@ |
||
337 | 337 | . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
338 | 338 | } |
339 | 339 | |
340 | - public function testObjectPropertiesReadOnly() |
|
341 | - { |
|
342 | - $object = new \SwaggerGen\SwaggerGen(); |
|
343 | - $array = $object->getSwagger(array(' |
|
340 | + public function testObjectPropertiesReadOnly() |
|
341 | + { |
|
342 | + $object = new \SwaggerGen\SwaggerGen(); |
|
343 | + $array = $object->getSwagger(array(' |
|
344 | 344 | api Test |
345 | 345 | endpoint /test |
346 | 346 | method GET something |
347 | 347 | response 200 object(a!:array(A),b:array(B)) |
348 | 348 | ')); |
349 | 349 | |
350 | - $this->assertSame('{"swagger":2,"info":{"title":"undefined","version":0}' |
|
351 | - . ',"paths":{"\/test":{"get":{"tags":["Test"],"summary":"something"' |
|
352 | - . ',"responses":{"200":{"description":"OK","schema":{"type":"object","required":["b"]' |
|
353 | - . ',"properties":{"a":{"type":"array","items":{"$ref":"#\/definitions\/A"}}' |
|
354 | - . ',"b":{"type":"array","items":{"$ref":"#\/definitions\/B"}}}}}}}}}' |
|
355 | - . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
|
356 | - } |
|
350 | + $this->assertSame('{"swagger":2,"info":{"title":"undefined","version":0}' |
|
351 | + . ',"paths":{"\/test":{"get":{"tags":["Test"],"summary":"something"' |
|
352 | + . ',"responses":{"200":{"description":"OK","schema":{"type":"object","required":["b"]' |
|
353 | + . ',"properties":{"a":{"type":"array","items":{"$ref":"#\/definitions\/A"}}' |
|
354 | + . ',"b":{"type":"array","items":{"$ref":"#\/definitions\/B"}}}}}}}}}' |
|
355 | + . ',"tags":[{"name":"Test"}]}', json_encode($array, JSON_NUMERIC_CHECK)); |
|
356 | + } |
|
357 | 357 | |
358 | 358 | public function testDeepObjectProperties() |
359 | 359 | { |
@@ -81,20 +81,20 @@ |
||
81 | 81 | ), $object->toArray()); |
82 | 82 | } |
83 | 83 | |
84 | - /** |
|
85 | - * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
|
86 | - */ |
|
87 | - public function testConstructReadOnly() |
|
88 | - { |
|
89 | - $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true); |
|
90 | - $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object); |
|
91 | - |
|
92 | - $this->assertSame(array( |
|
93 | - 'type' => 'string', |
|
94 | - 'description' => 'Some words here', |
|
95 | - 'readOnly' => true |
|
96 | - ), $object->toArray()); |
|
97 | - } |
|
84 | + /** |
|
85 | + * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
|
86 | + */ |
|
87 | + public function testConstructReadOnly() |
|
88 | + { |
|
89 | + $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true); |
|
90 | + $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object); |
|
91 | + |
|
92 | + $this->assertSame(array( |
|
93 | + 'type' => 'string', |
|
94 | + 'description' => 'Some words here', |
|
95 | + 'readOnly' => true |
|
96 | + ), $object->toArray()); |
|
97 | + } |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct |
@@ -29,7 +29,8 @@ |
||
29 | 29 | * |
30 | 30 | * @rest\api Users Get some useful information on users |
31 | 31 | */ |
32 | -class Example { |
|
32 | +class Example |
|
33 | +{ |
|
33 | 34 | |
34 | 35 | private $data = array(); |
35 | 36 |
@@ -30,10 +30,11 @@ |
||
30 | 30 | ); |
31 | 31 | } |
32 | 32 | |
33 | - public function provideAllCases() { |
|
33 | + public function provideAllCases() |
|
34 | + { |
|
34 | 35 | $cases = array(); |
35 | 36 | |
36 | - foreach (glob(__DIR__ . '/*', GLOB_ONLYDIR) as $dir) { |
|
37 | + foreach (glob(__DIR__ . '/*', GLOB_ONLYDIR) as $dir) { |
|
37 | 38 | $path = realpath($dir); |
38 | 39 | $json = $this->normalizeJson(file_get_contents($path . '/expected.json')); |
39 | 40 |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | return $this; |
143 | 143 | |
144 | 144 | case 'model': |
145 | - case 'model!': |
|
145 | + case 'model!': |
|
146 | 146 | case 'definition': |
147 | - case 'definition!': |
|
147 | + case 'definition!': |
|
148 | 148 | $name = self::wordShift($data); |
149 | 149 | if (empty($name)) { |
150 | 150 | throw new \SwaggerGen\Exception('Missing definition name'); |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | |
157 | 157 | $definition = new Schema($this, $typeDef); |
158 | 158 | if(substr($command, -1) === '!') { |
159 | - $definition->setReadOnly(); |
|
160 | - } |
|
159 | + $definition->setReadOnly(); |
|
160 | + } |
|
161 | 161 | $this->definitions[$name] = $definition; |
162 | 162 | return $definition; |
163 | 163 |
@@ -155,7 +155,7 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | $definition = new Schema($this, $typeDef); |
158 | - if(substr($command, -1) === '!') { |
|
158 | + if (substr($command, -1) === '!') { |
|
159 | 159 | $definition->setReadOnly(); |
160 | 160 | } |
161 | 161 | $this->definitions[$name] = $definition; |
@@ -120,7 +120,7 @@ |
||
120 | 120 | // Internal type if type known and not overwritten by definition |
121 | 121 | if (isset(self::$classTypes[$format])) { |
122 | 122 | $type = self::$classTypes[$format]; |
123 | - $class = "SwaggerGen\\Swagger\\Type\\{$type}Type"; |
|
123 | + $class = "SwaggerGen\\Swagger\\Type\\{$type}type"; |
|
124 | 124 | return new $class($parent, $definition); |
125 | 125 | } else { |
126 | 126 | return new ReferenceObjectType($parent, $definition); |