Passed
Pull Request — master (#578)
by
unknown
05:40
created
lib/Service/Gateway/Signal/Gateway.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -63,25 +63,25 @@  discard block
 block discarded – undo
63 63
 	public function send(IUser $user, string $identifier, string $message) {
64 64
 		$client = $this->clientService->newClient();
65 65
 		// determine type of gateway
66
-		$response = $client->get($this->config->getUrl() . '/v1/about');
66
+		$response = $client->get($this->config->getUrl().'/v1/about');
67 67
 		if ($response->getStatusCode() === 200) {
68 68
 			// New style gateway https://gitlab.com/morph027/signal-cli-dbus-rest-api
69 69
 			$response = $client->post(
70
-				$this->config->getUrl() . '/v1/send/' . $identifier,
70
+				$this->config->getUrl().'/v1/send/'.$identifier,
71 71
 				[
72 72
 					'json' => [ 'message' => $message ],
73 73
 				]
74 74
 			);
75 75
 			$body = $response->getBody();
76 76
 			$json = json_decode($body, true);
77
-			if ($response->getStatusCode() !== 201 || is_null($json) || !is_array($json) || (!isset($json['timestamps']) && !isset($json['timestamp']))) {
77
+			if ($response->getStatusCode() !== 201 || is_null($json) || !is_array($json) || (!isset($json[ 'timestamps' ]) && !isset($json[ 'timestamp' ]))) {
78 78
 				$status = $response->getStatusCode();
79 79
 				throw new SmsTransmissionException("error reported by Signal gateway, status=$status, body=$body}");
80 80
 			}
81 81
 		} else {
82 82
 			// Try old deprecated gateway https://gitlab.com/morph027/signal-web-gateway
83 83
 			$response = $client->post(
84
-				$this->config->getUrl() . '/v1/send/' . $identifier,
84
+				$this->config->getUrl().'/v1/send/'.$identifier,
85 85
 				[
86 86
 					'body' => [
87 87
 						'to' => $identifier,
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			$body = $response->getBody();
94 94
 			$json = json_decode($body, true);
95 95
 
96
-			if ($response->getStatusCode() !== 200 || is_null($json) || !is_array($json) || !isset($json['success']) || $json['success'] !== true) {
96
+			if ($response->getStatusCode() !== 200 || is_null($json) || !is_array($json) || !isset($json[ 'success' ]) || $json[ 'success' ] !== true) {
97 97
 				$status = $response->getStatusCode();
98 98
 				throw new SmsTransmissionException("error reported by Signal gateway, status=$status, body=$body}");
99 99
 			}
Please login to merge, or discard this patch.