@@ -63,7 +63,9 @@ discard block |
||
| 63 | 63 | // Check if ID already exists |
| 64 | 64 | $ids = []; |
| 65 | 65 | foreach ($responses as $response) { |
| 66 | - if ($response->id === null) continue; |
|
| 66 | + if ($response->id === null) { |
|
| 67 | + continue; |
|
| 68 | + } |
|
| 67 | 69 | if (in_array($response->id, $ids, true)) { |
| 68 | 70 | throw new Exception(Response::DUPLICATED_ID); |
| 69 | 71 | } |
@@ -74,7 +76,9 @@ discard block |
||
| 74 | 76 | return (string)$exception; |
| 75 | 77 | } |
| 76 | 78 | |
| 77 | - if (empty($responses)) return ''; |
|
| 79 | + if (empty($responses)) { |
|
| 80 | + return ''; |
|
| 81 | + } |
|
| 78 | 82 | return json_encode($multiple ? $responses : current($responses)); |
| 79 | 83 | } |
| 80 | 84 | |
@@ -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 | |
| 89 | 91 | if (isset($data->error->code)) { |
| 90 | 92 | $this->setResponsesError($data->error->code, (string)$data->error->message); |
@@ -96,9 +98,13 @@ discard block |
||
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | foreach ($data as $datum) { |
| 99 | - if (!is_object($datum) || !property_exists($datum, 'id')) continue; |
|
| 101 | + if (!is_object($datum) || !property_exists($datum, 'id')) { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 100 | 104 | $response = array_key_exists($datum->id, $this->responses) ? $this->responses[$datum->id] : null; |
| 101 | - if (!$response) continue; |
|
| 105 | + if (!$response) { |
|
| 106 | + continue; |
|
| 107 | + } |
|
| 102 | 108 | $response->resetError(); |
| 103 | 109 | $response->setProperties($datum); |
| 104 | 110 | } |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | public static function getProperty($object, string $property) |
| 17 | 17 | { |
| 18 | 18 | $reflection = new ReflectionClass($object); |
| 19 | - if (!$reflection->hasProperty($property)) return false; |
|
| 19 | + if (!$reflection->hasProperty($property)) { |
|
| 20 | + return false; |
|
| 21 | + } |
|
| 20 | 22 | $property = $reflection->getProperty($property); |
| 21 | 23 | $property->setAccessible(true); |
| 22 | 24 | return $property->getValue($object); |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | public static function callMethod($object, string $methodName, array $params = []) |
| 52 | 54 | { |
| 53 | 55 | $reflection = new ReflectionClass(get_class($object)); |
| 54 | - if (!$reflection->hasMethod($methodName)) return false; |
|
| 56 | + if (!$reflection->hasMethod($methodName)) { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 55 | 59 | $method = $reflection->getMethod($methodName); |
| 56 | 60 | $method->setAccessible(true); |
| 57 | 61 | return $method->invokeArgs($object, $params); |