yiisoft /
yii-gii
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Yiisoft\Yii\Gii; |
||
| 6 | |||
| 7 | use Closure; |
||
| 8 | |||
| 9 | final class GeneratorProxy |
||
| 10 | { |
||
| 11 | private ?GeneratorInterface $generator = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @psalm-param class-string<GeneratorInterface> $class |
||
| 15 | */ |
||
| 16 | 8 | public function __construct(private readonly Closure $loader, private readonly string $class) |
|
| 17 | { |
||
| 18 | 8 | } |
|
| 19 | |||
| 20 | /** |
||
| 21 | * @return class-string<GeneratorInterface> |
||
|
0 ignored issues
–
show
Documentation
Bug
introduced
by
Loading history...
|
|||
| 22 | */ |
||
| 23 | 2 | public function getClass(): string |
|
| 24 | { |
||
| 25 | 2 | return $this->class; |
|
| 26 | } |
||
| 27 | |||
| 28 | 2 | public function loadGenerator(): GeneratorInterface |
|
| 29 | { |
||
| 30 | 2 | return $this->generator ??= ($this->loader)(); |
|
| 31 | } |
||
| 32 | } |
||
| 33 |