Test Failed
Pull Request — master (#124)
by Dmitriy
14:27
created

GeneratorProxy::getClass()   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 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Gii;
6
7
use Closure;
8
9
class GeneratorProxy
10
{
11
    private ?GeneratorInterface $generator = null;
12
13
    /**
14
     * @psalm-param class-string<GeneratorCommandInterface> $class
15
     */
16
    public function __construct(private Closure $loader, private string $class)
17
    {
18
    }
19
20
    /**
21
     * @return class-string<GeneratorCommandInterface>
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<GeneratorCommandInterface> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<GeneratorCommandInterface>.
Loading history...
22
     */
23
    public function getClass(): string
24
    {
25
        return $this->class;
26
    }
27
28
    public function loadGenerator(): GeneratorInterface
29
    {
30
        return $this->generator ??= ($this->loader)();
31
    }
32
}
33