Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
75.00% |
3 / 4 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| ChainedBootGeneratedCode | |
75.00% |
3 / 4 |
|
66.67% |
2 / 3 |
4.25 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| createFromIterable | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| boot | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\StorageMetadataBuilder; |
| 3 | |
| 4 | use Apie\StorageMetadataBuilder\Interfaces\BootGeneratedCodeInterface; |
| 5 | use Apie\StorageMetadataBuilder\Mediators\GeneratedCode; |
| 6 | |
| 7 | final class ChainedBootGeneratedCode implements BootGeneratedCodeInterface |
| 8 | { |
| 9 | /** |
| 10 | * @var array<int, BootGeneratedCodeInterface> $bootCodeGenerators |
| 11 | */ |
| 12 | private array $bootCodeGenerators; |
| 13 | public function __construct(BootGeneratedCodeInterface... $bootCodeGenerators) |
| 14 | { |
| 15 | $this->bootCodeGenerators = $bootCodeGenerators; |
| 16 | } |
| 17 | |
| 18 | public static function createFromIterable(iterable $bootCodeGenerators): self |
| 19 | { |
| 20 | return new self(...$bootCodeGenerators); |
| 21 | } |
| 22 | |
| 23 | public function boot(GeneratedCode $generatedCode): void |
| 24 | { |
| 25 | foreach ($this->bootCodeGenerators as $bootCodeGenerator) { |
| 26 | $bootCodeGenerator->boot($generatedCode); |
| 27 | } |
| 28 | } |
| 29 | } |