Lines
33.33%
1 / 3
Methods
50.00%
1 / 2
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| getControllerName | 0.00% | 0 / 2 | 0.00% | 0 / 1 | 2 | ||
| 7 | readonly class RouteInfo | |
| 8 | { | |
| 9 | /** | |
| 10 | * Create a new RouteInfo instance | |
| 11 | * | |
| 12 | * @param string $controllerClass Fully qualified controller class name | |
| 13 | * @param string $method Controller method being executed | |
| 14 | * @param string $path The matched route path | |
| 15 | * @param string $httpMethod HTTP method (GET, POST, etc.) | |
| 16 | * @param array $parameters Route parameters extracted from the URL | |
| 17 | */ | |
| 18 | public function __construct( | |
| 19 | public string $controllerClass, | |
| 20 | public string $method, | |
| 21 | public string $path, | |
| 22 | public string $httpMethod, | |
| 23 | public array $parameters = [] | |
| 24 | ) {} | |
| 25 | ||
| 26 | /** | |
| 27 | * Get controller short name without a namespace | |
| 28 | * | |
| 29 | * @return string | |
| 30 | */ | |
| 31 | public function getControllerName(): string | |
| 32 | { | |
| 33 | $parts = explode('\\', $this->controllerClass); | |
| 34 | return end($parts); | |
| 35 | } | |
| 36 | } |