Inject::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 1
crap 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
/** @psalm-api */
11
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD)]
12
class Inject
13
{
14
    public array $args;
15
16 4
    public function __construct(mixed ...$args)
17
    {
18 4
        if (count($args) > 0) {
19 4
            if (is_int(array_key_first($args))) {
20 1
                throw new RuntimeException('Arguments for Inject must be named arguments');
21
            }
22
        }
23
24 3
        $this->args = $args;
25
    }
26
}
27