@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function __construct( |
| 29 | 29 | private readonly ?EventDispatcherInterface $dispatcher = null |
| 30 | - ) { |
|
| 30 | + ){ |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,7 +36,7 @@ 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 | $clone->interceptors[] = $interceptor; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function handle(CallContext $context): mixed |
| 57 | 57 | { |
| 58 | - if ($this->handler === null) { |
|
| 58 | + if ($this->handler === null){ |
|
| 59 | 59 | throw new InterceptorException('Unable to invoke pipeline without last handler.'); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (isset($this->interceptors[$this->position])) { |
|
| 62 | + if (isset($this->interceptors[$this->position])){ |
|
| 63 | 63 | $interceptor = $this->interceptors[$this->position]; |
| 64 | 64 | |
| 65 | 65 | $this->dispatcher?->dispatch(new InterceptorCalling(context: $context, interceptor: $interceptor)); |
@@ -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,7 @@ 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 | public function intercept(CallContextInterface $context, HandlerInterface $handler): mixed |
| 25 | 25 | { |
| 26 | 26 | return null; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $pipeline = $this->createPipeline(interceptors: [$interceptor], dispatcher: $dispatcher); |
| 40 | 40 | |
| 41 | 41 | $pipeline->withHandler( |
| 42 | - new class implements HandlerInterface { |
|
| 42 | + new class implements HandlerInterface{ |
|
| 43 | 43 | public function handle(CallContext $context): mixed |
| 44 | 44 | { |
| 45 | 45 | return null; |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | private function createPipeline( |
| 127 | 127 | array $interceptors = [], |
| 128 | - HandlerInterface|null $lastHandler = null, |
|
| 129 | - EventDispatcherInterface|null $dispatcher = null, |
|
| 128 | + HandlerInterface | null $lastHandler = null, |
|
| 129 | + EventDispatcherInterface | null $dispatcher = null, |
|
| 130 | 130 | ): InterceptorPipeline { |
| 131 | 131 | $pipeline = new InterceptorPipeline($dispatcher); |
| 132 | 132 | |
@@ -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; |