jerowork /
graphql-attribute-schema
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Jerowork\GraphqlAttributeSchema\NodeParser; |
||
| 6 | |||
| 7 | use Generator; |
||
| 8 | use ReflectionClass; |
||
| 9 | use ReflectionMethod; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @internal |
||
| 13 | */ |
||
| 14 | final readonly class ChainedNodeParser implements NodeParser |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @param iterable<NodeParser> $nodeParsers |
||
| 18 | */ |
||
| 19 | 4 | public function __construct( |
|
| 20 | private iterable $nodeParsers, |
||
| 21 | 4 | ) {} |
|
| 22 | |||
| 23 | 2 | public function parse(string $attribute, ReflectionClass $class, ?ReflectionMethod $method): Generator |
|
| 24 | { |
||
| 25 | 2 | foreach ($this->nodeParsers as $nodeParser) { |
|
| 26 | 2 | yield from $nodeParser->parse($attribute, $class, $method); |
|
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 |