Passed
Pull Request — master (#709)
by Vitor
04:34
created
lib/Provider/Channel/SMS/Provider/Drivers/PuzzelSMS.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		);
62 62
 	}
63 63
 
64
-	#[\Override]
64
+	#[\Override ]
65 65
 	public function send(string $identifier, string $message) {
66 66
 		try {
67 67
 			$this->client->get(
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 					'query' => [
71 71
 						'username' => $this->getUser(),
72 72
 						'password' => $this->getPassword(),
73
-						'message[0].recipient' => '+' . $identifier,
73
+						'message[0].recipient' => '+'.$identifier,
74 74
 						'message[0].content' => $message,
75 75
 						'serviceId' => $this->getServiceid(),
76 76
 					],
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/HuaweiE3531.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
 		);
45 45
 	}
46 46
 
47
-	#[\Override]
47
+	#[\Override ]
48 48
 	public function send(string $identifier, string $message) {
49 49
 		$url = $this->getApi();
50 50
 
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SerwerSMS.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		);
56 56
 	}
57 57
 
58
-	#[\Override]
58
+	#[\Override ]
59 59
 	public function send(string $identifier, string $message) {
60 60
 		$login = $this->getLogin();
61 61
 		$password = $this->getPassword();
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 			$responseData = json_decode((string)$response->getBody(), true);
78 78
 
79
-			if ($responseData['success'] !== true) {
79
+			if ($responseData[ 'success' ] !== true) {
80 80
 				throw new MessageTransmissionException();
81 81
 			}
82 82
 		} catch (Exception $ex) {
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/Ovh.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 		);
100 100
 	}
101 101
 
102
-	#[\Override]
102
+	#[\Override ]
103 103
 	public function send(string $identifier, string $message) {
104 104
 		$endpoint = $this->getEndpoint();
105 105
 		$sender = $this->getSender();
106 106
 		$smsAccount = $this->getAccount();
107 107
 
108
-		$this->attrs['AK'] = $this->getApplicationKey();
109
-		$this->attrs['AS'] = $this->getApplicationSecret();
110
-		$this->attrs['CK'] = $this->getConsumerKey();
111
-		if (!isset($this->endpoints[$endpoint])) {
108
+		$this->attrs[ 'AK' ] = $this->getApplicationKey();
109
+		$this->attrs[ 'AS' ] = $this->getApplicationSecret();
110
+		$this->attrs[ 'CK' ] = $this->getConsumerKey();
111
+		if (!isset($this->endpoints[ $endpoint ])) {
112 112
 			throw new InvalidProviderException("Endpoint $endpoint not found");
113 113
 		}
114
-		$this->attrs['endpoint'] = $this->endpoints[$endpoint];
114
+		$this->attrs[ 'endpoint' ] = $this->endpoints[ $endpoint ];
115 115
 
116 116
 		$this->getTimeDelta();
117 117
 
118
-		$header = $this->getHeader('GET', $this->attrs['endpoint'] . '/sms');
119
-		$response = $this->client->get($this->attrs['endpoint'] . '/sms', [
118
+		$header = $this->getHeader('GET', $this->attrs[ 'endpoint' ].'/sms');
119
+		$response = $this->client->get($this->attrs[ 'endpoint' ].'/sms', [
120 120
 			'headers' => $header,
121 121
 		]);
122 122
 		$body = (string)$response->getBody();
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 		];
145 145
 		$body = json_encode($content);
146 146
 
147
-		$header = $this->getHeader('POST', $this->attrs['endpoint'] . "/sms/$smsAccount/jobs", $body);
148
-		$response = $this->client->post($this->attrs['endpoint'] . "/sms/$smsAccount/jobs", [
147
+		$header = $this->getHeader('POST', $this->attrs[ 'endpoint' ]."/sms/$smsAccount/jobs", $body);
148
+		$response = $this->client->post($this->attrs[ 'endpoint' ]."/sms/$smsAccount/jobs", [
149 149
 			'headers' => $header,
150 150
 			'json' => $content,
151 151
 		]);
152 152
 		$body = (string)$response->getBody();
153 153
 		$resultPostJob = json_decode($body, true);
154 154
 
155
-		if (count($resultPostJob['validReceivers']) === 0) {
155
+		if (count($resultPostJob[ 'validReceivers' ]) === 0) {
156 156
 			throw new MessageTransmissionException("Bad receiver $identifier");
157 157
 		}
158 158
 	}
@@ -163,16 +163,16 @@  discard block
 block discarded – undo
163 163
 	 * @throws InvalidProviderException
164 164
 	 */
165 165
 	private function getTimeDelta(): void {
166
-		if (!isset($this->attrs['timedelta'])) {
167
-			if (!isset($this->attrs['endpoint'])) {
166
+		if (!isset($this->attrs[ 'timedelta' ])) {
167
+			if (!isset($this->attrs[ 'endpoint' ])) {
168 168
 				throw new InvalidProviderException('Need to set the endpoint');
169 169
 			}
170 170
 			try {
171
-				$response = $this->client->get($this->attrs['endpoint'] . '/auth/time');
171
+				$response = $this->client->get($this->attrs[ 'endpoint' ].'/auth/time');
172 172
 				$serverTimestamp = (int)$response->getBody();
173
-				$this->attrs['timedelta'] = $serverTimestamp - time();
173
+				$this->attrs[ 'timedelta' ] = $serverTimestamp - time();
174 174
 			} catch (Exception $ex) {
175
-				throw new InvalidProviderException('Unable to calculate time delta:' . $ex->getMessage());
175
+				throw new InvalidProviderException('Unable to calculate time delta:'.$ex->getMessage());
176 176
 			}
177 177
 		}
178 178
 	}
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 * @return array $header Contains the data for the request need by OVH
186 186
 	 */
187 187
 	private function getHeader($method, $query, $body = '') {
188
-		$timestamp = time() + $this->attrs['timedelta'];
189
-		$prehash = $this->attrs['AS'] . '+' . $this->attrs['CK'] . '+' . $method . '+' . $query . '+' . $body . '+' . $timestamp;
188
+		$timestamp = time() + $this->attrs[ 'timedelta' ];
189
+		$prehash = $this->attrs[ 'AS' ].'+'.$this->attrs[ 'CK' ].'+'.$method.'+'.$query.'+'.$body.'+'.$timestamp;
190 190
 		$header = [
191 191
 			'Content-Type' => 'application/json; charset=utf-8',
192
-			'X-Ovh-Application' => $this->attrs['AK'],
192
+			'X-Ovh-Application' => $this->attrs[ 'AK' ],
193 193
 			'X-Ovh-Timestamp' => $timestamp,
194
-			'X-Ovh-Signature' => '$1$' . sha1($prehash),
195
-			'X-Ovh-Consumer' => $this->attrs['CK'],
194
+			'X-Ovh-Signature' => '$1$'.sha1($prehash),
195
+			'X-Ovh-Consumer' => $this->attrs[ 'CK' ],
196 196
 		];
197 197
 		return $header;
198 198
 	}
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/PlaySMS.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 		);
56 56
 	}
57 57
 
58
-	#[\Override]
58
+	#[\Override ]
59 59
 	public function send(string $identifier, string $message) {
60 60
 		try {
61 61
 			$this->client->get(
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SMSGlobal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 		);
57 57
 	}
58 58
 
59
-	#[\Override]
59
+	#[\Override ]
60 60
 	public function send(string $identifier, string $message) {
61 61
 		$to = str_replace('+', '', $identifier);
62 62
 
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SipGate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		);
56 56
 	}
57 57
 
58
-	#[\Override]
58
+	#[\Override ]
59 59
 	public function send(string $identifier, string $message) {
60 60
 		$tokenId = $this->getTokenId();
61 61
 		$accessToken = $this->getAccessToken();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 		try {
65 65
 			$this->client->post('https://api.sipgate.com/v2/sessions/sms', [
66 66
 				'headers' => [
67
-					'Authorization' => 'Basic ' . base64_encode("$tokenId:$accessToken"),
67
+					'Authorization' => 'Basic '.base64_encode("$tokenId:$accessToken"),
68 68
 					'Content-Type' => 'application/json',
69 69
 					'Accept' => 'application/json',
70 70
 				],
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SpryngSMS.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		);
44 44
 	}
45 45
 
46
-	#[\Override]
46
+	#[\Override ]
47 47
 	public function send(string $identifier, string $message) {
48 48
 		try {
49 49
 			$this->client->post(
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 				[
52 52
 					'headers' => [
53 53
 						'Accept' => 'application/json',
54
-						'Authorization' => 'Bearer ' . $this->getApitoken(),
54
+						'Authorization' => 'Bearer '.$this->getApitoken(),
55 55
 						'Content-Type' => 'application/json',
56 56
 					],
57 57
 					'json' => [
58 58
 						'body' => $message,
59 59
 						'encoding' => 'plain',
60 60
 						'originator' => 'Nextcloud',
61
-						'recipients' => [$identifier],
61
+						'recipients' => [ $identifier ],
62 62
 						'route' => '1',
63 63
 					],
64 64
 				]
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/ClockworkSMS.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 		);
44 44
 	}
45 45
 
46
-	#[\Override]
46
+	#[\Override ]
47 47
 	public function send(string $identifier, string $message) {
48 48
 		try {
49 49
 			$response = $this->client->get(
Please login to merge, or discard this patch.