@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @access public |
| 155 | 155 | * @param mixed $parser |
| 156 | 156 | */ |
| 157 | - public function __construct($parser) |
|
| 157 | + public function __construct ($parser) |
|
| 158 | 158 | { |
| 159 | 159 | $this->parser = $parser ?: new StdParser; |
| 160 | 160 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @param Dispatcher $dispatcher |
| 167 | 167 | * @return Router |
| 168 | 168 | */ |
| 169 | - public function setDispatcher(Dispatcher $dispatcher) |
|
| 169 | + public function setDispatcher (Dispatcher $dispatcher) |
|
| 170 | 170 | { |
| 171 | 171 | $this->dispatcher = $dispatcher; |
| 172 | 172 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param CacheInterface $cachePool |
| 181 | 181 | * @return Router |
| 182 | 182 | */ |
| 183 | - public function setCachePool(CacheItemPoolInterface $cachePool) |
|
| 183 | + public function setCachePool (CacheItemPoolInterface $cachePool) |
|
| 184 | 184 | { |
| 185 | 185 | $this->cachePool = $cachePool; |
| 186 | 186 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param int $cacheTtl |
| 195 | 195 | * @return Router |
| 196 | 196 | */ |
| 197 | - public function setCacheTtl(int $cacheTtl) |
|
| 197 | + public function setCacheTtl (int $cacheTtl) |
|
| 198 | 198 | { |
| 199 | 199 | $this->cacheTtl = $cacheTtl; |
| 200 | 200 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @param string $cacheKey |
| 209 | 209 | * @return Router |
| 210 | 210 | */ |
| 211 | - public function setCacheKey(string $cacheKey) |
|
| 211 | + public function setCacheKey (string $cacheKey) |
|
| 212 | 212 | { |
| 213 | 213 | $this->cacheKey = $cacheKey; |
| 214 | 214 | return $this; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @param string $identifier |
| 222 | 222 | * @return null|Route |
| 223 | 223 | */ |
| 224 | - public function getRoute(string $identifier) |
|
| 224 | + public function getRoute (string $identifier) |
|
| 225 | 225 | { |
| 226 | 226 | return !empty($this->routes[$identifier]) ? $this->routes[$identifier] : null; |
| 227 | 227 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @access public |
| 233 | 233 | * @return array |
| 234 | 234 | */ |
| 235 | - public function getRoutes() |
|
| 235 | + public function getRoutes () |
|
| 236 | 236 | { |
| 237 | 237 | return $this->routes; |
| 238 | 238 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | * @param array $routes |
| 246 | 246 | * @return Router |
| 247 | 247 | */ |
| 248 | - public function setRoutes(array $method, array $routes) |
|
| 248 | + public function setRoutes (array $method, array $routes) |
|
| 249 | 249 | { |
| 250 | 250 | foreach ($routes as $pattern => $handler) { |
| 251 | 251 | $this->map($method, $pattern, $handler); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @access public |
| 261 | 261 | * @return void |
| 262 | 262 | */ |
| 263 | - public function getResult() |
|
| 263 | + public function getResult () |
|
| 264 | 264 | { |
| 265 | 265 | return $this->dispatch_result; |
| 266 | 266 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | /** |
| 269 | 269 | * {@inheritdoc} |
| 270 | 270 | */ |
| 271 | - public function map($method, string $pattern, $handler) |
|
| 271 | + public function map ($method, string $pattern, $handler) |
|
| 272 | 272 | { |
| 273 | 273 | $method = is_array($method) ? $method : [$method]; |
| 274 | 274 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @param mixed $handler |
| 297 | 297 | * @return Route Route |
| 298 | 298 | */ |
| 299 | - protected function createRoute(string $method, string $pattern, $handler) |
|
| 299 | + protected function createRoute (string $method, string $pattern, $handler) |
|
| 300 | 300 | { |
| 301 | 301 | return new Route($method, $pattern, $handler, $this->routeGroup, 'route_' . $this->routeCount); |
| 302 | 302 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @access protected |
| 308 | 308 | * @return void |
| 309 | 309 | */ |
| 310 | - protected function cacheAble() |
|
| 310 | + protected function cacheAble () |
|
| 311 | 311 | { |
| 312 | 312 | return !empty($this->cachePool) && !empty($this->cacheKey); |
| 313 | 313 | } |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | * @access protected |
| 319 | 319 | * @return CacheItemInterface |
| 320 | 320 | */ |
| 321 | - protected function getCacheItem() |
|
| 321 | + protected function getCacheItem () |
|
| 322 | 322 | { |
| 323 | - return $this->cacheAble() ? $this->cachePool->getItem($this->cacheKey) : new \Resilient\Dummy\CacheItem(); |
|
| 323 | + return $this->cacheAble() ? $this->cachePool->getItem($this->cacheKey) : new \Resilient\Dummy\CacheItem(); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | * @param array $options (default: []) |
| 332 | 332 | * @return Dispatcher |
| 333 | 333 | */ |
| 334 | - protected function routeDispatcher(callable $routeDefinitionCallback, array $options = []) |
|
| 334 | + protected function routeDispatcher (callable $routeDefinitionCallback, array $options = []) |
|
| 335 | 335 | { |
| 336 | 336 | $options += [ |
| 337 | 337 | 'routeParser' => 'FastRoute\\RouteParser\\Std', |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $routeCollector = new $options['routeCollector']( |
| 350 | 350 | new $options['routeParser'], new $options['dataGenerator'] |
| 351 | 351 | ); |
| 352 | - $routeDefinitionCallback ($routeCollector); |
|
| 352 | + $routeDefinitionCallback($routeCollector); |
|
| 353 | 353 | |
| 354 | 354 | $dispatchData = $routeCollector->getData(); |
| 355 | 355 | |
@@ -365,13 +365,13 @@ discard block |
||
| 365 | 365 | * @access protected |
| 366 | 366 | * @return Dispatcher |
| 367 | 367 | */ |
| 368 | - protected function createDispatcher() |
|
| 368 | + protected function createDispatcher () |
|
| 369 | 369 | { |
| 370 | 370 | if ($this->dispatcher) { |
| 371 | 371 | return $this->dispatcher; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - $this->dispatcher = $this->routeDispatcher(function (RouteCollector $r) { |
|
| 374 | + $this->dispatcher = $this->routeDispatcher(function(RouteCollector $r) { |
|
| 375 | 375 | foreach ($this->getRoutes() as $route) { |
| 376 | 376 | $r->addRoute($route->getMethod(), $route->getPattern(), $route->getIdentifier()); |
| 377 | 377 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | * @param string $method (default: 'GET') |
| 391 | 391 | * @return Route Handling Method |
| 392 | 392 | */ |
| 393 | - public function dispatch(UriInterface $uri, $method = 'GET') |
|
| 393 | + public function dispatch (UriInterface $uri, $method = 'GET') |
|
| 394 | 394 | { |
| 395 | 395 | $this->dispatch_result = $this->createDispatcher()->dispatch( |
| 396 | 396 | $method, |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | return $this->handleException($handling[0], $handling[1], $handling[2]); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - protected function handleException(string $handler, array $args, string $message) |
|
| 424 | + protected function handleException (string $handler, array $args, string $message) |
|
| 425 | 425 | { |
| 426 | 426 | if ($this->hasMethod($handler)) { |
| 427 | 427 | return $this->$handler(...$args); |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | * @param callable $callable |
| 438 | 438 | * @return Router |
| 439 | 439 | */ |
| 440 | - public function whenNotFound(callable $callable) |
|
| 440 | + public function whenNotFound (callable $callable) |
|
| 441 | 441 | { |
| 442 | 442 | $this->bind($this->notFoundFuncName, $callable); |
| 443 | 443 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * @param callable $callable |
| 452 | 452 | * @return Router |
| 453 | 453 | */ |
| 454 | - public function whenForbidden(callable $callable) |
|
| 454 | + public function whenForbidden (callable $callable) |
|
| 455 | 455 | { |
| 456 | 456 | $this->bind($this->forbiddenFuncName, $callable); |
| 457 | 457 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @param mixed $args |
| 467 | 467 | * @return void |
| 468 | 468 | */ |
| 469 | - protected function routerRoutine($identifier, $args) |
|
| 469 | + protected function routerRoutine ($identifier, $args) |
|
| 470 | 470 | { |
| 471 | 471 | $route = $this->getRoute($identifier); |
| 472 | 472 | |