Passed
Push — main ( a1a461...2097df )
by Thomas
12:50
created

Inject   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Chuck\Di;
6
7
use Attribute;
8
use Conia\Chuck\Exception\RuntimeException;
9
10
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD)]
11
class Inject
12
{
13
    public array $args;
14
15 4
    public function __construct(mixed ...$args)
16
    {
17 4
        if (count($args) > 0) {
18 4
            if (is_int(array_key_first($args))) {
19 1
                throw new RuntimeException('Arguments for Inject must be named arguments');
20
            }
21
        }
22
23 3
        $this->args = $args;
24
    }
25
}
26