| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | 34 | private function resolveParams(Route $route, $url) |
|
| 45 | { |
||
| 46 | 34 | preg_match_all('#' . $route->getPregPattern() . '#', $url, $values, PREG_SET_ORDER); |
|
| 47 | |||
| 48 | // If nothing found |
||
| 49 | 34 | if (count($values) === 0) { |
|
| 50 | 18 | return false; |
|
| 51 | } |
||
| 52 | |||
| 53 | // Remove full match from matches (leave only part matches) |
||
| 54 | 30 | $values = $values[0]; |
|
| 55 | 30 | array_shift($values); |
|
| 56 | |||
| 57 | 30 | $routeParams = $route->getParams(); |
|
| 58 | 30 | $result = array_filter($values, function($param) use ($routeParams) { |
|
| 59 | 20 | return in_array($param, $routeParams, true); |
|
| 60 | 30 | }, ARRAY_FILTER_USE_KEY); |
|
| 61 | |||
| 62 | 30 | return $result; |
|
| 63 | } |
||
| 64 | } |
||
| 65 |