@@ -45,7 +45,7 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $this->description = $data; |
| 48 | - $this->required = (bool)$required; |
|
| 48 | + $this->required = (bool) $required; |
|
| 49 | 49 | |
| 50 | 50 | $this->schema = new Schema($this, $type); |
| 51 | 51 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | $consumes = $this->getSwagger()->getConsumes(); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $valid_consumes = ((int)in_array('multipart/form-data', $consumes)) + ((int)in_array('application/x-www-form-urlencoded', $consumes)); |
|
| 43 | + $valid_consumes = ((int) in_array('multipart/form-data', $consumes)) + ((int) in_array('application/x-www-form-urlencoded', $consumes)); |
|
| 44 | 44 | if (empty($consumes) || $valid_consumes !== count($consumes)) { |
| 45 | 45 | throw new Exception("File type '{$definition}' without valid consume"); |
| 46 | 46 | } |
@@ -107,7 +107,7 @@ |
||
| 107 | 107 | 'termsOfService' => $this->termsofservice, |
| 108 | 108 | 'contact' => $this->contact ? $this->contact->toArray() : null, |
| 109 | 109 | 'license' => $this->license ? $this->license->toArray() : null, |
| 110 | - 'version' => (string)$this->version, |
|
| 110 | + 'version' => (string) $this->version, |
|
| 111 | 111 | ), parent::toArray())); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | * @copyright 2014-2017 Martijn van der Lee |
| 13 | 13 | * @license https://opensource.org/licenses/MIT MIT |
| 14 | 14 | */ |
| 15 | -class TypeRegistry |
|
| 16 | -{
|
|
| 15 | +class TypeRegistry |
|
| 16 | +{ |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Map of format-name => class-name |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function add(string $classname): void |
| 31 | 31 | {
|
| 32 | - if (is_subclass_of($classname, ICustomType::class)) {
|
|
| 33 | - foreach ($classname::getFormats() as $format) {
|
|
| 32 | + if (is_subclass_of($classname, ICustomType::class)) { |
|
| 33 | + foreach ($classname::getFormats() as $format) { |
|
| 34 | 34 | $this->formats[$format] = $classname; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @param string $name |
| 43 | 43 | */ |
| 44 | - public function remove($name) |
|
| 45 | - {
|
|
| 44 | + public function remove($name) |
|
| 45 | + { |
|
| 46 | 46 | $this->formats[$name] = null; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @return bool |
| 53 | 53 | */ |
| 54 | - public function has($name) |
|
| 55 | - {
|
|
| 54 | + public function has($name) |
|
| 55 | + { |
|
| 56 | 56 | return !empty($this->formats[$name]); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -61,8 +61,8 @@ discard block |
||
| 61 | 61 | * |
| 62 | 62 | * @return null|string |
| 63 | 63 | */ |
| 64 | - public function get($name) |
|
| 65 | - {
|
|
| 64 | + public function get($name) |
|
| 65 | + { |
|
| 66 | 66 | return !empty($this->formats[$name]) ? $this->formats[$name] : null; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -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; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * @rest\path Int id The ID of the User |
| 22 | 22 | * @rest\response 200 User |
| 23 | 23 | */ |
| 24 | - $app->get('/v1/users/{id:[0-9]+}', function ($request, $response, $args) { |
|
| 24 | + $app->get('/v1/users/{id:[0-9]+}', function($request, $response, $args) { |
|
| 25 | 25 | // ... |
| 26 | 26 | }); |
| 27 | 27 | } |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $this->exclusiveMinimum = $match[2] == '<'; |
| 83 | - $this->minimum = $match[3] === '' ? null : (int)$match[3]; |
|
| 84 | - $this->maximum = $match[4] === '' ? null : (int)$match[4]; |
|
| 83 | + $this->minimum = $match[3] === '' ? null : (int) $match[3]; |
|
| 84 | + $this->maximum = $match[4] === '' ? null : (int) $match[4]; |
|
| 85 | 85 | $this->exclusiveMaximum = isset($match[5]) ? ($match[5] == '>') : null; |
| 86 | 86 | if ($this->minimum && $this->maximum && $this->minimum > $this->maximum) { |
| 87 | 87 | self::swap($this->minimum, $this->maximum); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | return $this; |
| 126 | 126 | |
| 127 | 127 | case 'step': |
| 128 | - if (($step = (int)$data) > 0) { |
|
| 128 | + if (($step = (int) $data) > 0) { |
|
| 129 | 129 | $this->multipleOf = $step; |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - return (int)$value; |
|
| 177 | + return (int) $value; |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | } |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $exclusiveMinimum = $match[3] == '<'; |
| 107 | - $this->minItems = $match[4] === '' ? null : (int)$match[4]; |
|
| 108 | - $this->maxItems = $match[5] === '' ? null : (int)$match[5]; |
|
| 107 | + $this->minItems = $match[4] === '' ? null : (int) $match[4]; |
|
| 108 | + $this->maxItems = $match[5] === '' ? null : (int) $match[5]; |
|
| 109 | 109 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
| 110 | 110 | if ($this->minItems && $this->maxItems && $this->minItems > $this->maxItems) { |
| 111 | 111 | self::swap($this->minItems, $this->maxItems); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | switch (strtolower($command)) { |
| 141 | 141 | case 'min': |
| 142 | - $this->minItems = (int)$data; |
|
| 142 | + $this->minItems = (int) $data; |
|
| 143 | 143 | if ($this->minItems < 0) { |
| 144 | 144 | throw new Exception("Minimum less than zero: '{$data}'"); |
| 145 | 145 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | return $this; |
| 150 | 150 | |
| 151 | 151 | case 'max': |
| 152 | - $this->maxItems = (int)$data; |
|
| 152 | + $this->maxItems = (int) $data; |
|
| 153 | 153 | if ($this->minItems !== null && $this->minItems > $this->maxItems) { |
| 154 | 154 | throw new Exception("Maximum less than minimum: '{$data}'"); |
| 155 | 155 | } |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $exclusiveMinimum = $match[3] == '<'; |
| 146 | - $this->minProperties = $match[4] === '' ? null : (int)$match[4]; |
|
| 147 | - $this->maxProperties = $match[5] === '' ? null : (int)$match[5]; |
|
| 146 | + $this->minProperties = $match[4] === '' ? null : (int) $match[4]; |
|
| 147 | + $this->maxProperties = $match[5] === '' ? null : (int) $match[5]; |
|
| 148 | 148 | $exclusiveMaximum = isset($match[6]) ? ($match[6] == '>') : null; |
| 149 | 149 | if ($this->minProperties && $this->maxProperties && $this->minProperties > $this->maxProperties) { |
| 150 | 150 | self::swap($this->minProperties, $this->maxProperties); |
@@ -250,18 +250,18 @@ discard block |
||
| 250 | 250 | return $this; |
| 251 | 251 | |
| 252 | 252 | case 'min': |
| 253 | - $this->minProperties = (int)$data; |
|
| 253 | + $this->minProperties = (int) $data; |
|
| 254 | 254 | if ($this->minProperties < 0) { |
| 255 | 255 | throw new Exception("Minimum less than zero: '{$data}'"); |
| 256 | 256 | } |
| 257 | 257 | if ($this->maxProperties !== null && $this->minProperties > $this->maxProperties) { |
| 258 | 258 | throw new Exception("Minimum greater than maximum: '{$data}'"); |
| 259 | 259 | } |
| 260 | - $this->minProperties = (int)$data; |
|
| 260 | + $this->minProperties = (int) $data; |
|
| 261 | 261 | return $this; |
| 262 | 262 | |
| 263 | 263 | case 'max': |
| 264 | - $this->maxProperties = (int)$data; |
|
| 264 | + $this->maxProperties = (int) $data; |
|
| 265 | 265 | if ($this->minProperties !== null && $this->minProperties > $this->maxProperties) { |
| 266 | 266 | throw new Exception("Maximum less than minimum: '{$data}'"); |
| 267 | 267 | } |