Passed
Pull Request — master (#1104)
by Aleksei
26:20
created

CallContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Interceptors\Context;
6
7
final class CallContext implements CallContextInterface
8
{
9
    use AttributedTrait;
10
11
    /**
12
     * @param array<non-empty-string, mixed> $attributes
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<non-empty-string, mixed> at position 2 could not be parsed: Unknown type name 'non-empty-string' at position 2 in array<non-empty-string, mixed>.
Loading history...
13
     */
14 217
    public function __construct(
15
        private TargetInterface $target,
16
        private array $arguments = [],
17
        array $attributes = [],
18
    ) {
19 217
        $this->attributes = $attributes;
20
    }
21
22 206
    public function getTarget(): TargetInterface
23
    {
24 206
        return $this->target;
25
    }
26
27 205
    public function getArguments(): array
28
    {
29 205
        return $this->arguments;
30
    }
31
32 1
    public function withTarget(TargetInterface $target): static
33
    {
34 1
        $clone = clone $this;
35 1
        $clone->target = $target;
36 1
        return $clone;
37
    }
38
39 160
    public function withArguments(array $arguments): static
40
    {
41 160
        $clone = clone $this;
42 160
        $clone->arguments = $arguments;
43 160
        return $clone;
44
    }
45
}
46