@@ -84,7 +84,9 @@ discard block |
||
| 84 | 84 | public function send() |
| 85 | 85 | { |
| 86 | 86 | $data = $this->sendData(); |
| 87 | - if ($data === null) return; |
|
| 87 | + if ($data === null) { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 88 | 90 | if (isset($data->error->code) && $data->error->code === Response::PARSE_ERROR) { |
| 89 | 91 | return; |
| 90 | 92 | } |
@@ -93,9 +95,13 @@ discard block |
||
| 93 | 95 | } |
| 94 | 96 | |
| 95 | 97 | foreach ($data as $datum) { |
| 96 | - if (!is_object($datum) || !property_exists($datum, 'id')) continue; |
|
| 98 | + if (!is_object($datum) || !property_exists($datum, 'id')) { |
|
| 99 | + continue; |
|
| 100 | + } |
|
| 97 | 101 | $response = array_key_exists($datum->id, $this->responses) ? $this->responses[$datum->id] : null; |
| 98 | - if (!$response) continue; |
|
| 102 | + if (!$response) { |
|
| 103 | + continue; |
|
| 104 | + } |
|
| 99 | 105 | $response->resetError(); |
| 100 | 106 | $response->setProperties($datum); |
| 101 | 107 | } |
@@ -54,14 +54,18 @@ discard block |
||
| 54 | 54 | foreach ((array)$data as $datum) { |
| 55 | 55 | $request = (new Request)->setProperties($datum); |
| 56 | 56 | $response = $this->getResponse($request); |
| 57 | - if ($response->isNotification() && !$response->hasError()) continue; |
|
| 57 | + if ($response->isNotification() && !$response->hasError()) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 58 | 60 | $responses[] = $response->getData(); |
| 59 | 61 | } |
| 60 | 62 | |
| 61 | 63 | // Check if ID already exists |
| 62 | 64 | $ids = []; |
| 63 | 65 | foreach ($responses as $response) { |
| 64 | - if ($response->id === null) continue; |
|
| 66 | + if ($response->id === null) { |
|
| 67 | + continue; |
|
| 68 | + } |
|
| 65 | 69 | if (in_array($response->id, $ids, true)) { |
| 66 | 70 | throw new Exception(Response::DUPLICATED_ID); |
| 67 | 71 | } |
@@ -72,7 +76,9 @@ discard block |
||
| 72 | 76 | return (string)$exception; |
| 73 | 77 | } |
| 74 | 78 | |
| 75 | - if (empty($responses)) return ''; |
|
| 79 | + if (empty($responses)) { |
|
| 80 | + return ''; |
|
| 81 | + } |
|
| 76 | 82 | return json_encode($multiple ? $responses : current($responses)); |
| 77 | 83 | } |
| 78 | 84 | |