Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public static function getDestination() |
||
36 | { |
||
37 | $url = Url::instance(); |
||
38 | $matches = []; |
||
39 | |||
40 | foreach (static::$routes as $request => $destination) { |
||
41 | $pattern = '@^' . $url->format($request) . '$@'; |
||
42 | $match = preg_match($pattern, $url->getUrl(), $matches); |
||
43 | if ($match) { |
||
44 | $destination = array_pad(explode('@', $destination), 2, ''); |
||
45 | $destination[] = (array) array_splice($matches, 1); |
||
46 | |||
47 | return $destination; |
||
48 | } |
||
49 | } |
||
50 | |||
51 | throw new HttpException('Route not found', 404); |
||
52 | } |
||
54 |