Passed
Push — multi_binding ( 75a5e8 )
by Akihito
02:09
created

Set   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getKey() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Di\Di;
6
7
use Attribute;
8
9
use function sprintf;
10
11
#[Attribute(Attribute::TARGET_PARAMETER), Qualifier]
12
final class Set
13
{
14
    /** @var ""|class-string */
0 ignored issues
show
Documentation Bug introduced by
The doc comment ""|class-string at position 0 could not be parsed: Unknown type name '""' at position 0 in ""|class-string.
Loading history...
15
    public $interface;
16
17
    /** @var string */
18
    public $name;
19
20
    /**
21
     * @param ""|class-string $interface
0 ignored issues
show
Documentation Bug introduced by
The doc comment ""|class-string at position 0 could not be parsed: Unknown type name '""' at position 0 in ""|class-string.
Loading history...
22
     */
23
    public function __construct(string $interface, string $name = '')
24
    {
25
        $this->interface = $interface;
26
        $this->name = $name;
27
    }
28
29
    public function getKey(): string
30
    {
31
        return sprintf('%s-%s', $this->interface, $this->name);
32
    }
33
}
34