Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | 104 | private function areOptionalArgumentsAfterMandatoryArguments(string $path): bool |
|
44 | { |
||
45 | 104 | $parts = explode('/', $path); |
|
46 | 104 | $optionalParamFound = false; |
|
47 | |||
48 | 104 | foreach ($parts as $part) { |
|
49 | 104 | if (preg_match(RouteParams::OPTIONAL_PARAM_PATTERN, $part)) { |
|
50 | 10 | $optionalParamFound = true; |
|
51 | } else { |
||
52 | 104 | if ($optionalParamFound) { |
|
53 | // Mandatory argument or static part found after an optional argument |
||
54 | 2 | return false; |
|
55 | } |
||
56 | } |
||
57 | } |
||
58 | |||
59 | 102 | return true; |
|
60 | } |
||
62 |