Passed
Push — master ( 34d6e7...d243fe )
by Maurício
14:36 queued 15s
created

Link   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A withDifferentParams() 0 5 1
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpMyAdmin\Navigation\Nodes;
6
7
use function array_intersect_key;
8
use function array_merge;
9
10
readonly class Link
11
{
12
    /** @param array<string, mixed> $params */
13
    public function __construct(public string $title, public string $route, public array $params = [])
14
    {
15
    }
16
17
    /** @param array<string, mixed> $params */
18
    public function withDifferentParams(array $params): self
19
    {
20
        $params = array_merge($this->params, array_intersect_key($params, $this->params));
21
22
        return new self($this->title, $this->route, $params);
23
    }
24
}
25