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

Lazy::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Di\MultiBinding;
6
7
use Ray\Di\InjectorInterface;
8
9
final class Lazy
10
{
11
    /** @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 'class-string' at position 0 in class-string.
Loading history...
12
    private $class;
13
14
    /**
15
     * @param class-string $class
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
16
     */
17
    public function __construct(string $class)
18
    {
19
        $this->class = $class;
20
    }
21
22
    /**
23
     * @return mixed
24
     */
25
    public function __invoke(InjectorInterface $injector)
26
    {
27
        return $injector->getInstance($this->class);
28
    }
29
}
30