@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @param mixed $handler |
| 16 | 16 | * @return Route |
| 17 | 17 | */ |
| 18 | - public function get(string $pattern, $handler); |
|
| 18 | + public function get (string $pattern, $handler); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * post function. |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @param mixed $handler |
| 26 | 26 | * @return Route |
| 27 | 27 | */ |
| 28 | - public function post(string $pattern, $handler); |
|
| 28 | + public function post (string $pattern, $handler); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * put function. |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param mixed $handler |
| 36 | 36 | * @return Route |
| 37 | 37 | */ |
| 38 | - public function put(string $pattern, $handler); |
|
| 38 | + public function put (string $pattern, $handler); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * patch function. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param mixed $handler |
| 46 | 46 | * @return Route |
| 47 | 47 | */ |
| 48 | - public function patch(string $pattern, $handler); |
|
| 48 | + public function patch (string $pattern, $handler); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * delete function. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @param mixed $handler |
| 56 | 56 | * @return Route |
| 57 | 57 | */ |
| 58 | - public function delete(string $pattern, $handler); |
|
| 58 | + public function delete (string $pattern, $handler); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * options function. |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param mixed $handler |
| 66 | 66 | * @return Route |
| 67 | 67 | */ |
| 68 | - public function options(string $pattern, $handler); |
|
| 68 | + public function options (string $pattern, $handler); |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * any function. |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param mixed $handler |
| 76 | 76 | * @return Route |
| 77 | 77 | */ |
| 78 | - public function any(string $pattern, $handler); |
|
| 78 | + public function any (string $pattern, $handler); |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * map function. |
@@ -86,5 +86,5 @@ discard block |
||
| 86 | 86 | * @param mixed $handler |
| 87 | 87 | * @return mixed |
| 88 | 88 | */ |
| 89 | - public function map($methods, string $pattern, $handler); |
|
| 89 | + public function map ($methods, string $pattern, $handler); |
|
| 90 | 90 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param string $group (default: '') |
| 72 | 72 | * @param string $identifier (default: '') |
| 73 | 73 | */ |
| 74 | - public function __construct(string $method, string $pattern, $handler, $group = '', $identifier = '') |
|
| 74 | + public function __construct (string $method, string $pattern, $handler, $group = '', $identifier = '') |
|
| 75 | 75 | { |
| 76 | 76 | $this->method = $method; |
| 77 | 77 | $this->pattern = $pattern; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @access public |
| 87 | 87 | * @return string |
| 88 | 88 | */ |
| 89 | - public function getMethod() |
|
| 89 | + public function getMethod () |
|
| 90 | 90 | { |
| 91 | 91 | return $this->method; |
| 92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param string $method |
| 99 | 99 | * @return $this |
| 100 | 100 | */ |
| 101 | - public function setMethod(string $method) |
|
| 101 | + public function setMethod (string $method) |
|
| 102 | 102 | { |
| 103 | 103 | $this->method = $method; |
| 104 | 104 | return $this; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * @access public |
| 111 | 111 | * @return string |
| 112 | 112 | */ |
| 113 | - public function getPattern() |
|
| 113 | + public function getPattern () |
|
| 114 | 114 | { |
| 115 | 115 | return $this->pattern; |
| 116 | 116 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param string $pattern |
| 123 | 123 | * @return $this |
| 124 | 124 | */ |
| 125 | - public function setPattern(string $pattern) |
|
| 125 | + public function setPattern (string $pattern) |
|
| 126 | 126 | { |
| 127 | 127 | $this->pattern = $pattern; |
| 128 | 128 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | * @access public |
| 135 | 135 | * @return callable|string |
| 136 | 136 | */ |
| 137 | - public function getHandler() |
|
| 137 | + public function getHandler () |
|
| 138 | 138 | { |
| 139 | 139 | return $this->handler; |
| 140 | 140 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param string $handler |
| 148 | 148 | * @return $this |
| 149 | 149 | */ |
| 150 | - public function setHandler(string $handler) |
|
| 150 | + public function setHandler (string $handler) |
|
| 151 | 151 | { |
| 152 | 152 | $this->handler = $handler; |
| 153 | 153 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @access public |
| 161 | 161 | * @return array |
| 162 | 162 | */ |
| 163 | - public function getGroup() |
|
| 163 | + public function getGroup () |
|
| 164 | 164 | { |
| 165 | 165 | return $this->group; |
| 166 | 166 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param string $group |
| 173 | 173 | * @return $this |
| 174 | 174 | */ |
| 175 | - public function setGroup(string $group) |
|
| 175 | + public function setGroup (string $group) |
|
| 176 | 176 | { |
| 177 | 177 | $this->group = $group; |
| 178 | 178 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @access public |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
| 188 | - public function getIdentifier() |
|
| 188 | + public function getIdentifier () |
|
| 189 | 189 | { |
| 190 | 190 | return $this->identifier; |
| 191 | 191 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @param string $identifier |
| 198 | 198 | * @return $this |
| 199 | 199 | */ |
| 200 | - public function setIdentifier(string $identifier) |
|
| 200 | + public function setIdentifier (string $identifier) |
|
| 201 | 201 | { |
| 202 | 202 | $this->identifier = $identifier; |
| 203 | 203 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @param mixed $args |
| 212 | 212 | * @return $this |
| 213 | 213 | */ |
| 214 | - public function setArgs($args) |
|
| 214 | + public function setArgs ($args) |
|
| 215 | 215 | { |
| 216 | 216 | $this->args = $args; |
| 217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @access public |
| 225 | 225 | * @return array |
| 226 | 226 | */ |
| 227 | - public function getArgs() |
|
| 227 | + public function getArgs () |
|
| 228 | 228 | { |
| 229 | 229 | return $this->args; |
| 230 | 230 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * {@inheritdoc} |
| 12 | 12 | */ |
| 13 | - public function getKey() |
|
| 13 | + public function getKey () |
|
| 14 | 14 | { |
| 15 | 15 | return 'no-key'; |
| 16 | 16 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * {@inheritdoc} |
| 20 | 20 | */ |
| 21 | - public function get() |
|
| 21 | + public function get () |
|
| 22 | 22 | { |
| 23 | 23 | return null; |
| 24 | 24 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * {@inheritdoc} |
| 28 | 28 | */ |
| 29 | - public function isHit() |
|
| 29 | + public function isHit () |
|
| 30 | 30 | { |
| 31 | 31 | return false; |
| 32 | 32 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * {@inheritdoc} |
| 36 | 36 | */ |
| 37 | - public function set($value) |
|
| 37 | + public function set ($value) |
|
| 38 | 38 | { |
| 39 | 39 | return $this; |
| 40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * {@inheritdoc} |
| 44 | 44 | */ |
| 45 | - public function expiresAt($expiration) |
|
| 45 | + public function expiresAt ($expiration) |
|
| 46 | 46 | { |
| 47 | 47 | return $this; |
| 48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * {@inheritdoc} |
| 52 | 52 | */ |
| 53 | - public function expiresAfter($time) |
|
| 53 | + public function expiresAfter ($time) |
|
| 54 | 54 | { |
| 55 | 55 | return $this; |
| 56 | 56 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @param mixed $handler |
| 16 | 16 | * @return Route |
| 17 | 17 | */ |
| 18 | - public function get(string $pattern, $handler) |
|
| 18 | + public function get (string $pattern, $handler) |
|
| 19 | 19 | { |
| 20 | 20 | return $this->map('GET', $pattern, $handler); |
| 21 | 21 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param mixed $handler |
| 29 | 29 | * @return Route |
| 30 | 30 | */ |
| 31 | - public function post(string $pattern, $handler) |
|
| 31 | + public function post (string $pattern, $handler) |
|
| 32 | 32 | { |
| 33 | 33 | return $this->map('POST', $pattern, $handler); |
| 34 | 34 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param mixed $handler |
| 42 | 42 | * @return Route |
| 43 | 43 | */ |
| 44 | - public function put(string $pattern, $handler) |
|
| 44 | + public function put (string $pattern, $handler) |
|
| 45 | 45 | { |
| 46 | 46 | return $this->map('PUT', $pattern, $handler); |
| 47 | 47 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param mixed $handler |
| 55 | 55 | * @return Route |
| 56 | 56 | */ |
| 57 | - public function patch(string $pattern, $handler) |
|
| 57 | + public function patch (string $pattern, $handler) |
|
| 58 | 58 | { |
| 59 | 59 | return $this->map('PATCH', $pattern, $handler); |
| 60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param mixed $handler |
| 68 | 68 | * @return Route |
| 69 | 69 | */ |
| 70 | - public function delete(string $pattern, $handler) |
|
| 70 | + public function delete (string $pattern, $handler) |
|
| 71 | 71 | { |
| 72 | 72 | return $this->map('DELETE', $pattern, $handler); |
| 73 | 73 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param mixed $handler |
| 81 | 81 | * @return Route |
| 82 | 82 | */ |
| 83 | - public function options(string $pattern, $handler) |
|
| 83 | + public function options (string $pattern, $handler) |
|
| 84 | 84 | { |
| 85 | 85 | return $this->map('OPTIONS', $pattern, $handler); |
| 86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param mixed $handler |
| 94 | 94 | * @return Route |
| 95 | 95 | */ |
| 96 | - public function any(string $pattern, $handler) |
|
| 96 | + public function any (string $pattern, $handler) |
|
| 97 | 97 | { |
| 98 | 98 | return $this->map(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], $pattern, $handler); |
| 99 | 99 | } |
@@ -108,5 +108,5 @@ discard block |
||
| 108 | 108 | * @param mixed $handler |
| 109 | 109 | * @return Route |
| 110 | 110 | */ |
| 111 | - abstract public function map($methods, string $pattern, $handler); |
|
| 111 | + abstract public function map ($methods, string $pattern, $handler); |
|
| 112 | 112 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | protected $binded; |
| 12 | 12 | |
| 13 | - public function bind(string $name, callable $callable) |
|
| 13 | + public function bind (string $name, callable $callable) |
|
| 14 | 14 | { |
| 15 | 15 | if (!is_callable($callable)) { |
| 16 | 16 | throw new InvalidArgumentException('Second param must be callable'); |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | return $this; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function hasMethod(string $name) |
|
| 24 | + public function hasMethod (string $name) |
|
| 25 | 25 | { |
| 26 | 26 | return isset($this->binded[$name]); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function __call($name, array $args) |
|
| 29 | + public function __call ($name, array $args) |
|
| 30 | 30 | { |
| 31 | 31 | if ($this->hasMethod($name)) { |
| 32 | 32 | return $this->getBind($name, $args); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | throw new RunTimeException('There is no method with the given name to call'); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function getBind($name, $args) |
|
| 38 | + public function getBind ($name, $args) |
|
| 39 | 39 | { |
| 40 | 40 | return $this->binded[$name](...$args); |
| 41 | 41 | } |
@@ -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,12 +318,12 @@ discard block |
||
| 318 | 318 | * @access protected |
| 319 | 319 | * @return CacheItemInterface |
| 320 | 320 | */ |
| 321 | - protected function getCacheItem() |
|
| 321 | + protected function getCacheItem () |
|
| 322 | 322 | { |
| 323 | 323 | return $this->cacheAble() ? $this->cachePool->getItem($this->cacheKey) : new \Resilient\Dummy\CacheItem(); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - protected function saveCacheItem(CacheItemInterface $cacheItem) |
|
| 326 | + protected function saveCacheItem (CacheItemInterface $cacheItem) |
|
| 327 | 327 | { |
| 328 | 328 | if ($cacheItem instanceof \Resilient\Dummy\CacheItem) { |
| 329 | 329 | return false; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * @param array $options (default: []) |
| 345 | 345 | * @return Dispatcher |
| 346 | 346 | */ |
| 347 | - protected function routeDispatcher(callable $routeDefinitionCallback, array $options = []) |
|
| 347 | + protected function routeDispatcher (callable $routeDefinitionCallback, array $options = []) |
|
| 348 | 348 | { |
| 349 | 349 | $options += [ |
| 350 | 350 | 'routeParser' => 'FastRoute\\RouteParser\\Std', |
@@ -379,13 +379,13 @@ discard block |
||
| 379 | 379 | * @access protected |
| 380 | 380 | * @return Dispatcher |
| 381 | 381 | */ |
| 382 | - protected function createDispatcher() |
|
| 382 | + protected function createDispatcher () |
|
| 383 | 383 | { |
| 384 | 384 | if ($this->dispatcher) { |
| 385 | 385 | return $this->dispatcher; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - $this->dispatcher = $this->routeDispatcher(function (RouteCollector $r) { |
|
| 388 | + $this->dispatcher = $this->routeDispatcher(function(RouteCollector $r) { |
|
| 389 | 389 | foreach ($this->getRoutes() as $route) { |
| 390 | 390 | $r->addRoute($route->getMethod(), $route->getPattern(), $route->getIdentifier()); |
| 391 | 391 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | * @param string $method (default: 'GET') |
| 405 | 405 | * @return Route Handling Method |
| 406 | 406 | */ |
| 407 | - public function dispatch(UriInterface $uri, $method = 'GET') |
|
| 407 | + public function dispatch (UriInterface $uri, $method = 'GET') |
|
| 408 | 408 | { |
| 409 | 409 | $this->dispatch_result = $this->createDispatcher()->dispatch( |
| 410 | 410 | $method, |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | return $this->handleException($handling[0], $handling[1], $handling[2]); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - protected function handleException(string $handler, array $args, string $message) |
|
| 438 | + protected function handleException (string $handler, array $args, string $message) |
|
| 439 | 439 | { |
| 440 | 440 | if ($this->hasMethod($handler)) { |
| 441 | 441 | return $this->$handler(...$args); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | * @param callable $callable |
| 452 | 452 | * @return Router |
| 453 | 453 | */ |
| 454 | - public function whenNotFound(callable $callable) |
|
| 454 | + public function whenNotFound (callable $callable) |
|
| 455 | 455 | { |
| 456 | 456 | $this->bind($this->notFoundFuncName, $callable); |
| 457 | 457 | |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | * @param callable $callable |
| 466 | 466 | * @return Router |
| 467 | 467 | */ |
| 468 | - public function whenForbidden(callable $callable) |
|
| 468 | + public function whenForbidden (callable $callable) |
|
| 469 | 469 | { |
| 470 | 470 | $this->bind($this->forbiddenFuncName, $callable); |
| 471 | 471 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * @param mixed $args |
| 481 | 481 | * @return void |
| 482 | 482 | */ |
| 483 | - protected function routerRoutine($identifier, $args) |
|
| 483 | + protected function routerRoutine ($identifier, $args) |
|
| 484 | 484 | { |
| 485 | 485 | $route = $this->getRoute($identifier); |
| 486 | 486 | |