@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct( |
| 12 | 12 | private readonly CoreInterface $core |
| 13 | - ) { |
|
| 13 | + ){ |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function handle( |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function __construct( |
| 14 | 14 | private readonly InvokerInterface $invoker |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function handle(string $name, string $id, array $payload, array $context = []): void |
| 19 | 19 | { |
| 20 | - if (!isset($payload['callback'])) { |
|
| 20 | + if (!isset($payload['callback'])){ |
|
| 21 | 21 | throw new InvalidArgumentException('Payload `callback` key is required.'); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if (!$payload['callback'] instanceof \Closure) { |
|
| 24 | + if (!$payload['callback'] instanceof \Closure){ |
|
| 25 | 25 | throw new InvalidArgumentException('Payload `callback` key value type should be a closure.'); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -17,11 +17,13 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function handle(string $name, string $id, array $payload, array $context = []): void |
| 19 | 19 | { |
| 20 | - if (!isset($payload['callback'])) { |
|
| 20 | + if (!isset($payload['callback'])) |
|
| 21 | + { |
|
| 21 | 22 | throw new InvalidArgumentException('Payload `callback` key is required.'); |
| 22 | 23 | } |
| 23 | 24 | |
| 24 | - if (!$payload['callback'] instanceof \Closure) { |
|
| 25 | + if (!$payload['callback'] instanceof \Closure) |
|
| 26 | + { |
|
| 25 | 27 | throw new InvalidArgumentException('Payload `callback` key value type should be a closure.'); |
| 26 | 28 | } |
| 27 | 29 | |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function __construct( |
| 14 | 14 | private readonly InvokerInterface $invoker |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function handle(string $name, string $id, array $payload, array $context = []): void |
| 19 | 19 | { |
| 20 | - if (!isset($payload['object'])) { |
|
| 20 | + if (!isset($payload['object'])){ |
|
| 21 | 21 | throw new InvalidArgumentException('Payload `object` key is required.'); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - if (!\is_object($payload['object'])) { |
|
| 24 | + if (!\is_object($payload['object'])){ |
|
| 25 | 25 | throw new InvalidArgumentException('Payload `object` key value type should be an object.'); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -17,11 +17,13 @@ |
||
| 17 | 17 | |
| 18 | 18 | public function handle(string $name, string $id, array $payload, array $context = []): void |
| 19 | 19 | { |
| 20 | - if (!isset($payload['object'])) { |
|
| 20 | + if (!isset($payload['object'])) |
|
| 21 | + { |
|
| 21 | 22 | throw new InvalidArgumentException('Payload `object` key is required.'); |
| 22 | 23 | } |
| 23 | 24 | |
| 24 | - if (!\is_object($payload['object'])) { |
|
| 25 | + if (!\is_object($payload['object'])) |
|
| 26 | + { |
|
| 25 | 27 | throw new InvalidArgumentException('Payload `object` key value type should be an object.'); |
| 26 | 28 | } |
| 27 | 29 | |
@@ -19,17 +19,17 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function __construct( |
| 21 | 21 | protected InvokerInterface $invoker |
| 22 | - ) { |
|
| 22 | + ){ |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function handle(string $name, string $id, array $payload, array $context = []): void |
| 26 | 26 | { |
| 27 | - try { |
|
| 27 | + try{ |
|
| 28 | 28 | $this->invoker->invoke( |
| 29 | 29 | [$this, $this->getHandlerMethod()], |
| 30 | 30 | \array_merge(['payload' => $payload, 'id' => $id, 'context' => $context], $payload) |
| 31 | 31 | ); |
| 32 | - } catch (\Throwable $e) { |
|
| 32 | + }catch (\Throwable $e){ |
|
| 33 | 33 | $message = \sprintf('[%s] %s', $this::class, $e->getMessage()); |
| 34 | 34 | throw new JobException($message, (int)$e->getCode(), $e); |
| 35 | 35 | } |
@@ -24,12 +24,15 @@ |
||
| 24 | 24 | |
| 25 | 25 | public function handle(string $name, string $id, array $payload, array $context = []): void |
| 26 | 26 | { |
| 27 | - try { |
|
| 27 | + try |
|
| 28 | + { |
|
| 28 | 29 | $this->invoker->invoke( |
| 29 | 30 | [$this, $this->getHandlerMethod()], |
| 30 | 31 | \array_merge(['payload' => $payload, 'id' => $id, 'context' => $context], $payload) |
| 31 | 32 | ); |
| 32 | - } catch (\Throwable $e) { |
|
| 33 | + } |
|
| 34 | + catch (\Throwable $e) |
|
| 35 | + { |
|
| 33 | 36 | $message = \sprintf('[%s] %s', $this::class, $e->getMessage()); |
| 34 | 37 | throw new JobException($message, (int)$e->getCode(), $e); |
| 35 | 38 | } |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | public readonly string $id, |
| 14 | 14 | public readonly array $payload, |
| 15 | 15 | public readonly array $context = [] |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | public readonly string $id, |
| 14 | 14 | public readonly array $payload, |
| 15 | 15 | public readonly array $context = [] |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | } |
| 18 | 18 | } |