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

Injectable::__toString()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 1
nop 0
crap 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