Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
8 / 8 |
|
100.00% |
8 / 8 |
|
100.00% |
8 / 8 |
|
100.00% |
8 / 8 |
CRAP | |
100.00% |
1 / 1 |
| RouteToken | |
100.00% |
8 / 8 |
|
100.00% |
8 / 8 |
|
100.00% |
8 / 8 |
|
100.00% |
8 / 8 |
8 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| literal | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| parameter | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| remainder | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| type | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| value | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| name | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| constraint | |
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 | /** @internal */ |
| 8 | final readonly class RouteToken |
| 9 | { |
| 10 | public const string LITERAL = 'literal'; |
| 11 | public const string PARAMETER = 'parameter'; |
| 12 | public const string REMAINDER = 'remainder'; |
| 13 | |
| 14 | private function __construct( |
| 15 | private string $type, |
| 16 | private string $value = '', |
| 17 | private ?string $name = null, |
| 18 | private ?string $constraint = null, |
| 19 | ) {} |
| 20 | |
| 21 | public static function literal(string $value): self |
| 22 | { |
| 23 | return new self(self::LITERAL, $value); |
| 24 | } |
| 25 | |
| 26 | public static function parameter(string $name, ?string $constraint = null): self |
| 27 | { |
| 28 | return new self(self::PARAMETER, name: $name, constraint: $constraint); |
| 29 | } |
| 30 | |
| 31 | public static function remainder(string $name): self |
| 32 | { |
| 33 | return new self(self::REMAINDER, name: $name); |
| 34 | } |
| 35 | |
| 36 | public function type(): string |
| 37 | { |
| 38 | return $this->type; |
| 39 | } |
| 40 | |
| 41 | public function value(): string |
| 42 | { |
| 43 | return $this->value; |
| 44 | } |
| 45 | |
| 46 | public function name(): ?string |
| 47 | { |
| 48 | return $this->name; |
| 49 | } |
| 50 | |
| 51 | public function constraint(): ?string |
| 52 | { |
| 53 | return $this->constraint; |
| 54 | } |
| 55 | } |
Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not
necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once.
Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement
always has an else as part of its logical flow even if you didn't write one.
| 15 | private string $type, |
| 16 | private string $value = '', |
| 17 | private ?string $name = null, |
| 18 | private ?string $constraint = null, |
| 19 | ) {} |
| 53 | return $this->constraint; |
| 54 | } |
| 21 | public static function literal(string $value): self |
| 22 | { |
| 23 | return new self(self::LITERAL, $value); |
| 24 | } |
| 48 | return $this->name; |
| 49 | } |
| 26 | public static function parameter(string $name, ?string $constraint = null): self |
| 27 | { |
| 28 | return new self(self::PARAMETER, name: $name, constraint: $constraint); |
| 29 | } |
| 31 | public static function remainder(string $name): self |
| 32 | { |
| 33 | return new self(self::REMAINDER, name: $name); |
| 34 | } |
| 38 | return $this->type; |
| 39 | } |
| 43 | return $this->value; |
| 44 | } |