Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
25 | 5 | public function matchCollection($path) |
|
26 | { |
||
27 | 5 | foreach ($this->collection->all() as $route) { |
|
28 | 5 | $regex = $this->createRegex($route); |
|
29 | |||
30 | 5 | if (preg_match('#^'.$regex.'$#', $path, $matches)) { |
|
31 | $params = array_filter($matches, function ($key) { |
||
32 | 2 | return !is_int($key); |
|
33 | 2 | }, ARRAY_FILTER_USE_KEY); |
|
34 | return [ |
||
35 | 2 | 'controller' => $route->getDefault('controller'), |
|
36 | 2 | 'action' => $route->getDefault('action'), |
|
37 | 5 | 'params' => $params |
|
38 | ]; |
||
59 |