Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| RouteMatch | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| route | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| params | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| method | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Router; |
| 6 | |
| 7 | /** @psalm-api */ |
| 8 | final readonly class RouteMatch |
| 9 | { |
| 10 | private Route $route; |
| 11 | |
| 12 | /** @var array<string, string> */ |
| 13 | private array $params; |
| 14 | |
| 15 | private string $method; |
| 16 | |
| 17 | /** @param array<string, string> $params */ |
| 18 | public function __construct(Route $route, array $params, string $method) |
| 19 | { |
| 20 | $this->route = $route; |
| 21 | $this->params = $params; |
| 22 | $this->method = strtoupper($method); |
| 23 | } |
| 24 | |
| 25 | public function route(): Route |
| 26 | { |
| 27 | return $this->route; |
| 28 | } |
| 29 | |
| 30 | /** @return array<string, string> */ |
| 31 | public function params(): array |
| 32 | { |
| 33 | return $this->params; |
| 34 | } |
| 35 | |
| 36 | public function method(): string |
| 37 | { |
| 38 | return $this->method; |
| 39 | } |
| 40 | } |