@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $this->options = $options; |
| 24 | 24 | $this->checkCacheFile(); |
| 25 | 25 | |
| 26 | - if (!isset($this->options['errorHandlers']['default'])){ |
|
| 26 | + if (!isset($this->options['errorHandlers']['default'])) { |
|
| 27 | 27 | throw new \Exception('Error Handlers must be specified'); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * Check cache file and update self::$cacheDisabled |
| 36 | 36 | * @return bool |
| 37 | 37 | */ |
| 38 | - public function checkCacheFile(){ |
|
| 38 | + public function checkCacheFile() { |
|
| 39 | 39 | $cacheDir = isset($this->options['cacheFile']) |
| 40 | 40 | ? $this->options['cacheFile'] : __DIR__; |
| 41 | 41 | |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | * @param string $requestTarget |
| 57 | 57 | * @return RouterResponse |
| 58 | 58 | */ |
| 59 | - public function match(array $routes, $method, $requestTarget){ |
|
| 59 | + public function match(array $routes, $method, $requestTarget) { |
|
| 60 | 60 | |
| 61 | 61 | //remove end slash variation. |
| 62 | - $formattedRequest = rtrim($requestTarget,"/"); |
|
| 63 | - $formattedRequest = $formattedRequest."/"; |
|
| 62 | + $formattedRequest = rtrim($requestTarget, "/"); |
|
| 63 | + $formattedRequest = $formattedRequest . "/"; |
|
| 64 | 64 | |
| 65 | 65 | $response = [ |
| 66 | 66 | 'statusCode' => 500, |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | 'vars' => [] |
| 69 | 69 | ]; |
| 70 | 70 | |
| 71 | - $routeInfo = $this->getCachedDispatcher($routes)->dispatch($method, $formattedRequest); |
|
| 71 | + $routeInfo = $this->getCachedDispatcher($routes)->dispatch($method, $formattedRequest); |
|
| 72 | 72 | |
| 73 | 73 | switch ($routeInfo[0]) { |
| 74 | 74 | case Dispatcher::FOUND: |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | * @param $code |
| 104 | 104 | * @return mixed |
| 105 | 105 | */ |
| 106 | - public function findHandler($code){ |
|
| 106 | + public function findHandler($code) { |
|
| 107 | 107 | $handlerName = $this->options['handler']; |
| 108 | 108 | $handlerArgs = $this->options['errorHandlers']['default']; |
| 109 | - if (isset($this->options['errorHandlers'][$code])){ |
|
| 109 | + if (isset($this->options['errorHandlers'][$code])) { |
|
| 110 | 110 | $handlerArgs = $this->options['errorHandlers'][$code]; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | * @param array $routes |
| 122 | 122 | * @return FastRouteAdaptor |
| 123 | 123 | */ |
| 124 | - public function getCachedDispatcher(array $routes = []){ |
|
| 124 | + public function getCachedDispatcher(array $routes = []) { |
|
| 125 | 125 | |
| 126 | 126 | return \FastRoute\cachedDispatcher( |
| 127 | 127 | function(RouteCollector $r) use ($routes){ |
| 128 | - foreach($routes as $route){ |
|
| 129 | - $r->addRoute($route['method'],$route['pattern'],$route['handler']); |
|
| 128 | + foreach ($routes as $route) { |
|
| 129 | + $r->addRoute($route['method'], $route['pattern'], $route['handler']); |
|
| 130 | 130 | } |
| 131 | 131 | }, |
| 132 | 132 | $this->options |