Total Complexity | 10 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Path |
||
9 | { |
||
10 | 2 | public static function fitsPattern($path, $pattern) |
|
11 | { |
||
12 | 2 | $path = explode('/', $path); |
|
13 | 2 | $pattern = explode('/', $pattern); |
|
14 | |||
15 | 2 | foreach ($path as $i => $item) { |
|
16 | 2 | if (!isset($pattern[$i])) { |
|
17 | 2 | return false; |
|
18 | } |
||
19 | 2 | $pitem = $pattern[$i]; |
|
20 | 2 | if ($pitem === '...') { |
|
21 | 2 | return true; |
|
22 | } |
||
23 | 2 | if (($pitem === '*') || $pitem === $item) { |
|
24 | 2 | continue; |
|
25 | } else { |
||
26 | 2 | return false; |
|
27 | } |
||
28 | } |
||
29 | 2 | if (count($pattern) > count($path)) { |
|
30 | 2 | return false; |
|
31 | } |
||
32 | 2 | return true; |
|
33 | } |
||
34 | |||
35 | 1 | public static function quoteUrldecode($path) |
|
44 | } |
||
45 | } |