@@ -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 | } |
@@ -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 | } |
@@ -142,7 +142,7 @@ |
||
| 142 | 142 | if ($data === '') { |
| 143 | 143 | throw new Exception("Missing content for type example"); |
| 144 | 144 | } |
| 145 | - $json = preg_replace_callback('/([^{}:,]+)/', static function ($match) { |
|
| 145 | + $json = preg_replace_callback('/([^{}:,]+)/', static function($match) { |
|
| 146 | 146 | json_decode($match[1]); |
| 147 | 147 | return json_last_error() === JSON_ERROR_NONE ? $match[1] : json_encode($match[1]); |
| 148 | 148 | }, trim($data)); |
@@ -156,8 +156,8 @@ |
||
| 156 | 156 | 'format' => empty($this->format) ? null : $this->format, |
| 157 | 157 | 'pattern' => $this->pattern, |
| 158 | 158 | 'default' => $this->default, |
| 159 | - 'minLength' => $this->minLength ? (int)$this->minLength : null, |
|
| 160 | - 'maxLength' => $this->maxLength ? (int)$this->maxLength : null, |
|
| 159 | + 'minLength' => $this->minLength ? (int) $this->minLength : null, |
|
| 160 | + 'maxLength' => $this->maxLength ? (int) $this->maxLength : null, |
|
| 161 | 161 | 'enum' => $this->enum, |
| 162 | 162 | ), parent::toArray())); |
| 163 | 163 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | static $lookup = null; |
| 97 | 97 | |
| 98 | 98 | if (is_numeric($search)) { |
| 99 | - return (int)$search; |
|
| 99 | + return (int) $search; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | // build static lookup table |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | if ($data === '') { |
| 164 | 164 | throw new Exception('Missing content for example `' . $name . '`'); |
| 165 | 165 | } |
| 166 | - $json = preg_replace_callback('/([^{}:]+)/', static function ($match) { |
|
| 166 | + $json = preg_replace_callback('/([^{}:]+)/', static function($match) { |
|
| 167 | 167 | json_decode($match[1]); |
| 168 | 168 | return json_last_error() === JSON_ERROR_NONE ? $match[1] : json_encode($match[1]); |
| 169 | 169 | }, trim($data)); |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | $this->name = $name; |
| 78 | 78 | |
| 79 | 79 | $this->description = $data; |
| 80 | - $this->required = (bool)$required; |
|
| 80 | + $this->required = (bool) $required; |
|
| 81 | 81 | |
| 82 | 82 | // Parse regex |
| 83 | 83 | $match = []; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public static function arrayFilterNull($array): array |
| 64 | 64 | { |
| 65 | - return array_filter($array, static function ($value) { |
|
| 65 | + return array_filter($array, static function($value) { |
|
| 66 | 66 | return $value !== null && $value !== []; |
| 67 | 67 | }); |
| 68 | 68 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public static function objectsToArray($array): array |
| 76 | 76 | { |
| 77 | - return array_map(static function (AbstractObject $item) { |
|
| 77 | + return array_map(static function(AbstractObject $item) { |
|
| 78 | 78 | return $item->toArray(); |
| 79 | 79 | }, $array); |
| 80 | 80 | } |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | if (!function_exists('yaml_emit')) { |
| 146 | 146 | throw new Exception('YAML extension not installed.'); |
| 147 | 147 | } |
| 148 | - array_walk_recursive($output, static function (&$value) { |
|
| 148 | + array_walk_recursive($output, static function(&$value) { |
|
| 149 | 149 | if (is_object($value)) { |
| 150 | - $value = (array)$value; |
|
| 150 | + $value = (array) $value; |
|
| 151 | 151 | } |
| 152 | 152 | }); |
| 153 | 153 | $output = yaml_emit($output, YAML_UTF8_ENCODING, YAML_LN_BREAK); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | if ($result !== $top) { |
| 220 | 220 | // Remove all similar classes from array first! |
| 221 | 221 | $classname = get_class($result); |
| 222 | - $stack = array_filter($stack, static function ($class) use ($classname) { |
|
| 222 | + $stack = array_filter($stack, static function($class) use ($classname) { |
|
| 223 | 223 | return !(is_a($class, $classname)); |
| 224 | 224 | }); |
| 225 | 225 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | $stacktrace = []; |
| 240 | 240 | foreach ($stack as $object) { |
| 241 | - $stacktrace[] = (string)$object; |
|
| 241 | + $stacktrace[] = (string) $object; |
|
| 242 | 242 | } |
| 243 | 243 | $messages[] = implode(', ' . PHP_EOL, $stacktrace); |
| 244 | 244 | |