Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | protected function executeEvent(?string $payload): ?string |
||
18 | { |
||
19 | if ($payload === null) { |
||
20 | throw new \InvalidArgumentException('Empty payload. JSON message expected.'); |
||
21 | } |
||
22 | $data = \json_decode($payload, true); |
||
23 | if (JSON_ERROR_NONE !== json_last_error()) { |
||
24 | throw new \InvalidArgumentException( |
||
25 | 'json_decode error: ' . json_last_error_msg() |
||
26 | ); |
||
27 | } |
||
28 | $result = $this->executeJsonEvent($data); |
||
29 | if ($result === null) { |
||
30 | return null; |
||
31 | } |
||
32 | return \GuzzleHttp\json_encode($result); |
||
33 | } |
||
35 |