| Conditions | 5 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 54 | private static function hasValidParameterOrder(string $path): bool |
||
| 55 | { |
||
| 56 | $parts = explode('/', $path); |
||
| 57 | $optionalParamFound = false; |
||
| 58 | |||
| 59 | foreach ($parts as $part) { |
||
| 60 | if (!$part) { // Empty part found |
||
| 61 | return false; |
||
| 62 | } |
||
| 63 | if (preg_match(RouteParams::OPTIONAL_PARAM_PATTERN, $part)) { // Optional argument found |
||
| 64 | $optionalParamFound = true; |
||
| 65 | } elseif ($optionalParamFound) { // Mandatory argument or static part found after an optional argument |
||
| 66 | return false; |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 70 | return true; |
||
| 71 | } |
||
| 73 |