Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
23 | 2 | public function resolve(mixed $field): Webonyx\InputObjectField |
|
24 | { |
||
25 | /** @psalm-suppress RedundantPropertyInitializationCheck */ |
||
26 | 2 | if (! isset($this->queue)) { |
|
27 | 1 | throw new NextHandlerIsEmptyException('Cannot invoke pipeline resolver more than once'); |
|
28 | } |
||
29 | |||
30 | 2 | if ($this->queue->isEmpty()) { |
|
31 | 1 | unset($this->queue); |
|
32 | |||
33 | 1 | return $this->fallbackResolver->resolve($field); |
|
34 | } |
||
35 | |||
36 | /** @var MiddlewareInterface $middleware */ |
||
37 | 1 | $middleware = $this->queue->extract(); |
|
38 | |||
39 | 1 | $next = clone $this; |
|
40 | 1 | unset($this->queue); |
|
41 | |||
42 | 1 | return $middleware->process($field, $next); |
|
43 | } |
||
45 |