MAPG-204 clean up result sending
This commit is contained in:
4 files changed
+72
-79
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
class MultiConnector
|
||||
{
|
||||
public function sendMessage(string $func, array $args = []): void
|
||||
public function sendMessage(string $func, array $args = [])
|
||||
{
|
||||
$message = json_encode([
|
||||
'func' => $func,
|
||||
@@ -17,8 +17,10 @@ class MultiConnector
|
||||
}
|
||||
fclose($connection);
|
||||
|
||||
if ($response !== 'OK') {
|
||||
throw new \Exception('Sending message failed with response: ' . $response);
|
||||
$response = json_decode($response, true);
|
||||
|
||||
if (isset($response['data'])) {
|
||||
return $response['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user