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

Icon::withDifferentParams()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 3
cp 0
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
crap 2
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 Icon
11
{
12
    /** @param array<string, mixed> $params */
13
    public function __construct(
14
        public string $image,
15
        public string $title,
16
        public string $route,
17
        public array $params = [],
18
    ) {
19
    }
20
21
    /** @param array<string, mixed> $params */
22
    public function withDifferentParams(array $params): self
23
    {
24
        $params = array_merge($this->params, array_intersect_key($params, $this->params));
25
26
        return new self($this->image, $this->title, $this->route, $params);
27
    }
28
}
29