@@ -36,7 +36,8 @@ discard block |
||
| 36 | 36 | public function withInterceptors(InterceptorInterface ...$interceptors): self |
| 37 | 37 | { |
| 38 | 38 | $clone = clone $this; |
| 39 | - foreach ($interceptors as $interceptor) { |
|
| 39 | + foreach ($interceptors as $interceptor) |
|
| 40 | + { |
|
| 40 | 41 | $clone->interceptors[] = $interceptor; |
| 41 | 42 | } |
| 42 | 43 | |
@@ -55,11 +56,13 @@ discard block |
||
| 55 | 56 | */ |
| 56 | 57 | public function handle(CallContext $context): mixed |
| 57 | 58 | { |
| 58 | - if ($this->handler === null) { |
|
| 59 | + if ($this->handler === null) |
|
| 60 | + { |
|
| 59 | 61 | throw new InterceptorException('Unable to invoke pipeline without last handler.'); |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | - if (isset($this->interceptors[$this->position])) { |
|
| 64 | + if (isset($this->interceptors[$this->position])) |
|
| 65 | + { |
|
| 63 | 66 | $interceptor = $this->interceptors[$this->position]; |
| 64 | 67 | |
| 65 | 68 | $this->dispatcher?->dispatch(new InterceptorCalling(context: $context, interceptor: $interceptor)); |
@@ -20,7 +20,8 @@ discard block |
||
| 20 | 20 | public function testInterceptorCallingEventShouldBeDispatched(): void |
| 21 | 21 | { |
| 22 | 22 | $context = $this->createPathContext(['test', 'test2']); |
| 23 | - $interceptor = new class implements InterceptorInterface { |
|
| 23 | + $interceptor = new class implements InterceptorInterface |
|
| 24 | + { |
|
| 24 | 25 | public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed |
| 25 | 26 | { |
| 26 | 27 | return null; |
@@ -39,7 +40,8 @@ discard block |
||
| 39 | 40 | $pipeline = $this->createPipeline(interceptors: [$interceptor], dispatcher: $dispatcher); |
| 40 | 41 | |
| 41 | 42 | $pipeline->withHandler( |
| 42 | - new class implements HandlerInterface { |
|
| 43 | + new class implements HandlerInterface |
|
| 44 | + { |
|
| 43 | 45 | public function handle(CallContext $context): mixed |
| 44 | 46 | { |
| 45 | 47 | return null; |