| Conditions | 4 |
| Paths | 4 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4.0092 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 39 | 6 | public function isMatched(\ReRoute\RequestContext $requestContext) { |
|
| 40 | 6 | $prefix = $this->getPrefix(); |
|
| 41 | 6 | if (empty($prefix)) { |
|
| 42 | return true; |
||
| 43 | } |
||
| 44 | 6 | if (strpos($requestContext->getPath(), $prefix) === 0) { |
|
| 45 | 6 | $pathWithoutPrefix = (string) substr($requestContext->getPath(), strlen($prefix)); |
|
| 46 | 6 | if (substr($pathWithoutPrefix, 0, 1) != '/') { |
|
| 47 | 6 | $pathWithoutPrefix = '/' . $pathWithoutPrefix; |
|
| 48 | 6 | } |
|
| 49 | 6 | $requestContext->setPath($pathWithoutPrefix); |
|
| 50 | 6 | return true; |
|
| 51 | } |
||
| 52 | 3 | return false; |
|
| 53 | } |
||
| 54 | |||
| 65 | } |