Total Complexity | 10 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class Regex extends AbstractParser |
||
10 | { |
||
11 | protected $regex; |
||
12 | |||
13 | 3 | public function parseMap() |
|
17 | 3 | } |
|
18 | |||
19 | /** |
||
20 | * @param $uri |
||
21 | * @return bool |
||
22 | */ |
||
23 | 1 | public function match($uri) |
|
24 | { |
||
25 | 1 | $return = parent::match($uri); |
|
26 | |||
27 | 1 | if ($return) { |
|
|
|||
28 | 1 | $match = preg_match_all("`^" . $this->getRegex() . "$`i", $uri, $matches); |
|
29 | |||
30 | 1 | if ($match > 0) { |
|
31 | 1 | $variables = $this->getVariables(); |
|
32 | 1 | if (count($variables)) { |
|
33 | 1 | foreach ($variables as $key => $variable) { |
|
34 | 1 | $this->matches[$variable] = $matches[$key + 1][0]; |
|
35 | } |
||
36 | } |
||
37 | 1 | return true; |
|
38 | } |
||
39 | } |
||
40 | |||
41 | 1 | return false; |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return mixed|string |
||
46 | */ |
||
47 | 2 | public function getRegex() |
|
62 | } |
||
63 | } |
||
64 |