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