@@ -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 |
@@ -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( |
@@ -200,13 +200,13 @@ discard block |
||
200 | 200 | } |
201 | 201 | |
202 | 202 | |
203 | - public function setExample(?string $example): void |
|
203 | + public function setExample(? string $example) : void |
|
204 | 204 | { |
205 | 205 | $this->example = $example; |
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | - public function getExample(): ?string |
|
209 | + public function getExample(): ? string |
|
210 | 210 | { |
211 | 211 | return $this->example; |
212 | 212 | } |
@@ -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]> |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $return = []; |
159 | 159 | |
160 | - preg_replace_callback('/<(\w+)>/', function ($item) use (&$return) { |
|
160 | + preg_replace_callback('/<(\w+)>/', function($item) use (&$return) { |
|
161 | 161 | $return[] = end($item); |
162 | 162 | }, $this->path); |
163 | 163 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $required = []; |
181 | 181 | |
182 | - preg_replace_callback('/<(\w+)>/', function ($item) use (&$required) { |
|
182 | + preg_replace_callback('/<(\w+)>/', function($item) use (&$required) { |
|
183 | 183 | $required[] = end($item); |
184 | 184 | }, $path); |
185 | 185 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | /** |
260 | 260 | * Maps HTTP request to a Request object. |
261 | 261 | */ |
262 | - public function match(Nette\Http\IRequest $httpRequest): ?Request |
|
262 | + public function match(Nette\Http\IRequest $httpRequest): ? Request |
|
263 | 263 | { |
264 | 264 | /** |
265 | 265 | * ApiRoute can be easily disabled |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $order = &$this->placeholder_order; |
279 | 279 | $parameters = $this->parameters; |
280 | 280 | |
281 | - $mask = preg_replace_callback('/(<(\w+)>)|\[|\]/', function ($item) use (&$order, $parameters) { |
|
281 | + $mask = preg_replace_callback('/(<(\w+)>)|\[|\]/', function($item) use (&$order, $parameters) { |
|
282 | 282 | if ($item[0] == '[' || $item[0] == ']') { |
283 | 283 | if ($item[0] == '[') { |
284 | 284 | $order[] = null; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | return $item[0]; |
288 | 288 | } |
289 | 289 | |
290 | - [, , $placeholder] = $item; |
|
290 | + [,, $placeholder] = $item; |
|
291 | 291 | |
292 | 292 | $parameter = $parameters[$placeholder] ?? []; |
293 | 293 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | return sprintf('(%s)', $regex); |
307 | 307 | }, $this->path); |
308 | 308 | |
309 | - $mask = '^' . str_replace(['[', ']'], ['(', ')?'], $mask) . '$'; |
|
309 | + $mask = '^'.str_replace(['[', ']'], ['(', ')?'], $mask).'$'; |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Prepare paths for regex match (escape slashes) |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | array_shift($matches); |
340 | 340 | |
341 | 341 | foreach ($this->placeholder_order as $key => $name) { |
342 | - if ($name !== null&& isset($matches[$key])) { |
|
342 | + if ($name !== null && isset($matches[$key])) { |
|
343 | 343 | $params[$name] = reset($matches[$key]) ?: null; |
344 | 344 | |
345 | 345 | /** |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Constructs absolute URL from Request object. |
374 | 374 | */ |
375 | - public function constructUrl(Request $request, Nette\Http\Url $url): ?string |
|
375 | + public function constructUrl(Request $request, Nette\Http\Url $url): ? string |
|
376 | 376 | { |
377 | 377 | if ($this->presenter != $request->getPresenterName()) { |
378 | 378 | return null; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
400 | - $path = preg_replace_callback('/\[.+?\]/', function ($item) { |
|
400 | + $path = preg_replace_callback('/\[.+?\]/', function($item) { |
|
401 | 401 | if (strpos(end($item), '<')) { |
402 | 402 | return ''; |
403 | 403 | } |
@@ -416,6 +416,6 @@ discard block |
||
416 | 416 | |
417 | 417 | $query = http_build_query($parameters); |
418 | 418 | |
419 | - return $base_url . $path . ($query ? '?' . $query : ''); |
|
419 | + return $base_url.$path.($query ? '?'.$query : ''); |
|
420 | 420 | } |
421 | 421 | } |