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