Passed
Pull Request — master (#941)
by Aleksei
13:25 queued 04:54
created

Injectable   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 2
c 1
b 0
f 0
dl 0
loc 13
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __toString() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Config;
6
7
use Spiral\Core\Container\InjectorInterface;
8
9
/**
10
 * Means that the value should be injected by an injector.
11
 *
12
 * @see InjectorInterface
13
 */
14
final class Injectable extends Binding
15
{
16
    /**
17
     * @param string|InjectorInterface $injector Injector object or binding alias.
18
     */
19 394
    public function __construct(
20
        public readonly string|InjectorInterface $injector,
21
    ) {
22 394
    }
23
24 1
    public function __toString(): string
25
    {
26 1
        return sprintf('Injectable with %s', \is_string($this->injector) ? $this->injector : $this->injector::class);
27
    }
28
}
29