@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * @copyright Copyright (c) 2016 ublaboo <[email protected]> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * @copyright Copyright (c) 2016 ublaboo <[email protected]> |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function __construct(array $data) |
| 87 | 87 | { |
| 88 | 88 | foreach ($data as $key => $value) { |
| 89 | - $method = 'set' . str_replace('_', '', ucwords($key, '_')); |
|
| 89 | + $method = 'set'.str_replace('_', '', ucwords($key, '_')); |
|
| 90 | 90 | |
| 91 | 91 | if (!method_exists($this, $method)) { |
| 92 | 92 | throw new ApiRouteWrongPropertyException( |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * @copyright Copyright (c) 2016 ublaboo <[email protected]> |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $return = []; |
| 179 | 179 | |
| 180 | - preg_replace_callback('/<(\w+)>/', function ($item) use (&$return) { |
|
| 180 | + preg_replace_callback('/<(\w+)>/', function($item) use (&$return) { |
|
| 181 | 181 | $return[] = end($item); |
| 182 | 182 | }, $this->path); |
| 183 | 183 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $required = []; |
| 202 | 202 | |
| 203 | - preg_replace_callback('/<(\w+)>/', function ($item) use (&$required) { |
|
| 203 | + preg_replace_callback('/<(\w+)>/', function($item) use (&$required) { |
|
| 204 | 204 | $required[] = end($item); |
| 205 | 205 | }, $path); |
| 206 | 206 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | $order = &$this->placeholder_order; |
| 318 | 318 | $parameters = $this->parameters; |
| 319 | 319 | |
| 320 | - $mask = preg_replace_callback('/(<(\w+)>)|\[|\]/', function ($item) use (&$order, $parameters) { |
|
| 320 | + $mask = preg_replace_callback('/(<(\w+)>)|\[|\]/', function($item) use (&$order, $parameters) { |
|
| 321 | 321 | if ($item[0] == '[' || $item[0] == ']') { |
| 322 | 322 | if ($item[0] == '[') { |
| 323 | 323 | $order[] = null; |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | return $item[0]; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - [, , $placeholder] = $item; |
|
| 329 | + [,, $placeholder] = $item; |
|
| 330 | 330 | |
| 331 | 331 | $parameter = $parameters[$placeholder] ?? []; |
| 332 | 332 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | return sprintf('(%s)', $regex); |
| 346 | 346 | }, $this->path); |
| 347 | 347 | |
| 348 | - $mask = '^' . str_replace(['[', ']'], ['(', ')?'], $mask) . '$'; |
|
| 348 | + $mask = '^'.str_replace(['[', ']'], ['(', ')?'], $mask).'$'; |
|
| 349 | 349 | |
| 350 | 350 | /** |
| 351 | 351 | * Prepare paths for regex match (escape slashes) |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | array_shift($matches); |
| 379 | 379 | |
| 380 | 380 | foreach ($this->placeholder_order as $key => $name) { |
| 381 | - if ($name !== null&& isset($matches[$key])) { |
|
| 381 | + if ($name !== null && isset($matches[$key])) { |
|
| 382 | 382 | $params[$name] = reset($matches[$key]) ?: null; |
| 383 | 383 | |
| 384 | 384 | /** |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - $path = preg_replace_callback('/\[.+?\]/', function ($item) { |
|
| 440 | + $path = preg_replace_callback('/\[.+?\]/', function($item) { |
|
| 441 | 441 | if (strpos(end($item), '<')) { |
| 442 | 442 | return ''; |
| 443 | 443 | } |
@@ -456,6 +456,6 @@ discard block |
||
| 456 | 456 | |
| 457 | 457 | $query = http_build_query($parameters); |
| 458 | 458 | |
| 459 | - return $base_url . $path . ($query ? '?' . $query : ''); |
|
| 459 | + return $base_url.$path.($query ? '?'.$query : ''); |
|
| 460 | 460 | } |
| 461 | 461 | } |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ublaboo\ApiRouter\Exception; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Ublaboo\ApiRouter\Exception; |
| 5 | 5 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * @copyright Copyright (c) 2016 ublaboo <[email protected]> |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | * Prepare AnnotationRegistry |
| 64 | 64 | */ |
| 65 | - AnnotationRegistry::registerFile(__DIR__ . '/../ApiRoute.php'); |
|
| 66 | - AnnotationRegistry::registerFile(__DIR__ . '/../ApiRouteSpec.php'); |
|
| 65 | + AnnotationRegistry::registerFile(__DIR__.'/../ApiRoute.php'); |
|
| 66 | + AnnotationRegistry::registerFile(__DIR__.'/../ApiRouteSpec.php'); |
|
| 67 | 67 | |
| 68 | 68 | AnnotationReader::addGlobalIgnoredName('persistent'); |
| 69 | 69 | AnnotationReader::addGlobalIgnoredName('inject'); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | private function setupReader(array $compiler_config): void |
| 78 | 78 | { |
| 79 | - $cache_path = $compiler_config['parameters']['tempDir'] . '/cache/ApiRouter.Annotations'; |
|
| 79 | + $cache_path = $compiler_config['parameters']['tempDir'].'/cache/ApiRouter.Annotations'; |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Prepare AnnotationReader - use cached values |