RouterMatch::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 5
ccs 0
cts 0
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Sunday\Extension\Router;
6
7
use Override;
8
use Stringable;
9
10
use function http_build_query;
11
12
class RouterMatch implements Stringable
13
{
14
    /** @param array<string, mixed> $query */
15
    public function __construct(
16
        public string $method = '',
17
        public string $path = '',
18
        public array $query = [],
19
    ) {
20
    }
21
22
    #[Override]
23
    public function __toString(): string
24
    {
25
        $querySymbol = $this->query ? '?' : '';
26
27
        return "{$this->method} {$this->path}{$querySymbol}" . http_build_query($this->query);
28
    }
29
}
30