RouterMatch   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 5
Bugs 2 Features 0
Metric Value
eloc 2
c 5
b 2
f 0
dl 0
loc 15
ccs 0
cts 0
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 5 2
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Sunday\Extension\Router;
6
7
use Stringable;
8
9
use function http_build_query;
10
11
class RouterMatch implements Stringable
12
{
13
    /** @param array<string, mixed> $query */
14
    public function __construct(
15
        public string $method = '',
16
        public string $path = '',
17
        public array $query = [],
18
    ) {
19
    }
20
21
    public function __toString(): string
22
    {
23
        $querySymbol = $this->query ? '?' : '';
24
25
        return "{$this->method} {$this->path}{$querySymbol}" . http_build_query($this->query);
26
    }
27
}
28