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