Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
1 / 1
RouteToken
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
8 / 8
8
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 literal
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 parameter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 remainder
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 type
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 value
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 name
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 constraint
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Router;
6
7/** @internal */
8final 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}

Paths

Below are the source code lines that represent each code path as identified by Xdebug. Please note a path is not necessarily coterminous with a line, a line may contain multiple paths and therefore show up more than once. Please also be aware that some paths may include implicit rather than explicit branches, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

RouteToken->__construct
15        private string $type,
16        private string $value = '',
17        private ?string $name = null,
18        private ?string $constraint = null,
19    ) {}
RouteToken->constraint
53        return $this->constraint;
54    }
RouteToken->literal
21    public static function literal(string $value): self
22    {
23        return new self(self::LITERAL, $value);
24    }
RouteToken->name
48        return $this->name;
49    }
RouteToken->parameter
26    public static function parameter(string $name, ?string $constraint = null): self
27    {
28        return new self(self::PARAMETER, name: $name, constraint: $constraint);
29    }
RouteToken->remainder
31    public static function remainder(string $name): self
32    {
33        return new self(self::REMAINDER, name: $name);
34    }
RouteToken->type
38        return $this->type;
39    }
RouteToken->value
43        return $this->value;
44    }