@@ -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 | |
@@ -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 | |
@@ -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 | } |