| Conditions | 3 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3.0123 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 2 | public function match(Route $route) : array |
|
| 16 | {
|
||
| 17 | 2 | assert(isset($this->app['request'])); |
|
| 18 | |||
| 19 | 2 | $verbRegexp = '#^'.$route->getHttpVerb().'$#i'; // case insensitive |
|
| 20 | 2 | $pathRegexp = '#^'.$route->getPath().'$#'; // case sensitive |
|
| 21 | |||
| 22 | 2 | $matches = null; |
|
| 23 | try {
|
||
| 24 | 2 | preg_match($verbRegexp, $this->app['request']->getMethod()) && |
|
| 25 | 2 | preg_match($pathRegexp, $this->app['request']->getPathInfo(),$matches); |
|
| 26 | } catch (Exception $e) {
|
||
| 27 | // just ignore regexp errors ... |
||
| 28 | } |
||
| 29 | |||
| 30 | 2 | return $matches; |
|
| 31 | } |
||
| 32 | } |