Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 2 | Features | 2 |
1 | <?php |
||
18 | public function __invoke(Request $request) |
||
19 | { |
||
20 | $eventPayload = $this->getJsonPayloadFromRequest($request); |
||
21 | if (! isset($eventPayload['type'])) { |
||
22 | throw WebhookFailed::missingType($request); |
||
23 | } |
||
24 | $type = $eventPayload['type']; |
||
25 | $WebhookCall = new WebhookCall($eventPayload); |
||
|
|||
26 | event("multicoin-webhooks::{$type}", $WebhookCall); |
||
27 | $jobClass = $this->determineJobClass($type); |
||
28 | if ('' === $jobClass) { |
||
29 | return; |
||
30 | } |
||
31 | if (! class_exists($jobClass)) { |
||
32 | throw WebhookFailed::jobClassDoesNotExist($jobClass, $WebhookCall); |
||
33 | } |
||
34 | dispatch(new $jobClass($WebhookCall)); |
||
35 | } |
||
47 |