Conditions | 6 |
Paths | 10 |
Total Lines | 25 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 6.0585 |
Changes | 5 | ||
Bugs | 2 | Features | 4 |
1 | <?php |
||
21 | 26 | public function match(Request $request) |
|
22 | { |
||
23 | 26 | $baseUri = $request->getBaseUrl(); |
|
24 | 26 | $uri = $request->getRequestUri(); |
|
25 | |||
26 | 26 | if(!empty($baseUri) && \strpos($uri, $baseUri) === 0) { |
|
27 | $uri = \substr($uri, strlen($baseUri)); |
||
28 | } |
||
29 | |||
30 | 26 | $uri = trim($uri, '/'); |
|
31 | 26 | if (empty($uri)) { |
|
32 | 2 | return null; |
|
33 | } |
||
34 | |||
35 | 24 | if (strpos($uri, '?') > 0) { |
|
36 | 7 | list($uri,) = explode('?', $uri); |
|
37 | 7 | } |
|
38 | |||
39 | 24 | $actionName = false; |
|
40 | 24 | if (\preg_match($this->actionRegex, $uri, $matches)) { |
|
41 | 20 | $actionName = $matches[1]; |
|
42 | 20 | } |
|
43 | |||
44 | 24 | return $actionName; |
|
45 | } |
||
46 | |||
56 | } |