| Total Complexity | 7 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 75% |
| Changes | 4 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | final class Gii implements GiiInterface |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @param array<string, GeneratorInterface|LazyGenerator> $generators |
||
| 17 | */ |
||
| 18 | 8 | public function __construct(private array $generators) |
|
| 19 | { |
||
| 20 | 8 | } |
|
| 21 | |||
| 22 | public function addGenerator(GeneratorInterface $generator): void |
||
| 25 | } |
||
| 26 | |||
| 27 | 1 | public function getGenerator(string $id): GeneratorInterface |
|
| 28 | { |
||
| 29 | 1 | if (!isset($this->generators[$id])) { |
|
| 30 | 1 | throw new GeneratorNotFoundException('Generator "' . $id . '" not found'); |
|
| 31 | } |
||
| 32 | |||
| 33 | return $this->generators[$id] instanceof Closure ? $this->generators[$id]() : $this->generators[$id]; |
||
| 34 | } |
||
| 35 | |||
| 36 | 4 | public function getGenerators(): array |
|
| 41 | 4 | ); |
|
| 42 | } |
||
| 44 |