Completed
Push — master ( b4d3c2...2479a1 )
by Vitor
15s queued 12s
created
lib/PhoneNumberMask.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,6 @@
 block discarded – undo
33 33
 		$length = strlen($number);
34 34
 		$start = $length - 3;
35 35
 
36
-		return str_repeat('*', $start) . substr($number, $start);
36
+		return str_repeat('*', $start).substr($number, $start);
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
lib/Exception/SmsTransmissionException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types = 1);
3
+declare(strict_types=1);
4 4
 
5 5
 /**
6 6
  * @author Christoph Wurst <[email protected]>
Please login to merge, or discard this patch.
lib/Service/Gateway/SMS/Provider/SerwerSMS.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
 
71 71
 			$responseData = json_decode($response->getBody(), true);
72 72
 
73
-			if ($responseData['success'] !== true) {
73
+			if ($responseData[ 'success' ] !== true) {
74 74
 				throw new SmsTransmissionException();
75 75
 			}
76 76
 		} catch (Exception $ex) {
Please login to merge, or discard this patch.
lib/Service/Gateway/SMS/Provider/Ovh.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 		$sender = $config->getSender();
86 86
 		$smsAccount = $config->getAccount();
87 87
 
88
-		$this->attrs['AK'] = $config->getApplicationKey();
89
-		$this->attrs['AS'] = $config->getApplicationSecret();
90
-		$this->attrs['CK'] = $config->getConsumerKey();
91
-		if (!isset($this->endpoints[$endpoint])) {
88
+		$this->attrs[ 'AK' ] = $config->getApplicationKey();
89
+		$this->attrs[ 'AS' ] = $config->getApplicationSecret();
90
+		$this->attrs[ 'CK' ] = $config->getConsumerKey();
91
+		if (!isset($this->endpoints[ $endpoint ])) {
92 92
 			throw new InvalidSmsProviderException("Endpoint $endpoint not found");
93 93
 		}
94
-		$this->attrs['endpoint'] = $this->endpoints[$endpoint];
94
+		$this->attrs[ 'endpoint' ] = $this->endpoints[ $endpoint ];
95 95
 
96 96
 		$this->getTimeDelta();
97 97
 
98
-		$header = $this->getHeader('GET', $this->attrs['endpoint'].'/sms');
99
-		$response = $this->client->get($this->attrs['endpoint'].'/sms', [
98
+		$header = $this->getHeader('GET', $this->attrs[ 'endpoint' ].'/sms');
99
+		$response = $this->client->get($this->attrs[ 'endpoint' ].'/sms', [
100 100
 			'headers' => $header,
101 101
 		]);
102 102
 		$smsServices = json_decode($response->getBody(), true);
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 		];
124 124
 		$body = json_encode($content);
125 125
 
126
-		$header = $this->getHeader('POST', $this->attrs['endpoint']."/sms/$smsAccount/jobs", $body);
127
-		$response = $this->client->post($this->attrs['endpoint']."/sms/$smsAccount/jobs", [
126
+		$header = $this->getHeader('POST', $this->attrs[ 'endpoint' ]."/sms/$smsAccount/jobs", $body);
127
+		$response = $this->client->post($this->attrs[ 'endpoint' ]."/sms/$smsAccount/jobs", [
128 128
 			'headers' => $header,
129 129
 			'json' => $content,
130 130
 		]);
131 131
 		$resultPostJob = json_decode($response->getBody(), true);
132 132
 
133
-		if (count($resultPostJob["validReceivers"]) === 0) {
133
+		if (count($resultPostJob[ "validReceivers" ]) === 0) {
134 134
 			throw new SmsTransmissionException("Bad receiver $identifier");
135 135
 		}
136 136
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 	 * @throws InvalidSmsProviderException
148 148
 	 */
149 149
 	private function getTimeDelta() {
150
-		if (!isset($this->attrs['timedelta'])) {
151
-			if (!isset($this->attrs['endpoint'])) {
150
+		if (!isset($this->attrs[ 'timedelta' ])) {
151
+			if (!isset($this->attrs[ 'endpoint' ])) {
152 152
 				throw new InvalidSmsProviderException('Need to set the endpoint');
153 153
 			}
154 154
 			try {
155
-				$response = $this->client->get($this->attrs['endpoint'].'/auth/time');
156
-				$serverTimestamp = (int)$response->getBody();
157
-				$this->attrs['timedelta'] = $serverTimestamp - time();
155
+				$response = $this->client->get($this->attrs[ 'endpoint' ].'/auth/time');
156
+				$serverTimestamp = (int) $response->getBody();
157
+				$this->attrs[ 'timedelta' ] = $serverTimestamp - time();
158 158
 			} catch (Exception $ex) {
159 159
 				throw new InvalidSmsProviderException('Unable to calculate time delta:'.$ex->getMessage());
160 160
 			}
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 	 * @return array $header Contains the data for the request need by OVH
170 170
 	 */
171 171
 	private function getHeader($method, $query, $body = '') {
172
-		$timestamp = time() + $this->attrs['timedelta'];
173
-		$prehash = $this->attrs['AS'].'+'.$this->attrs['CK'].'+'.$method.'+'.$query.'+'.$body.'+'.$timestamp;
172
+		$timestamp = time() + $this->attrs[ 'timedelta' ];
173
+		$prehash = $this->attrs[ 'AS' ].'+'.$this->attrs[ 'CK' ].'+'.$method.'+'.$query.'+'.$body.'+'.$timestamp;
174 174
 		$header = [
175 175
 			'Content-Type' => 'application/json; charset=utf-8',
176
-			'X-Ovh-Application' => $this->attrs['AK'],
176
+			'X-Ovh-Application' => $this->attrs[ 'AK' ],
177 177
 			'X-Ovh-Timestamp' => $timestamp,
178 178
 			'X-Ovh-Signature' => '$1$'.sha1($prehash),
179
-			'X-Ovh-Consumer' => $this->attrs['CK'],
179
+			'X-Ovh-Consumer' => $this->attrs[ 'CK' ],
180 180
 		];
181 181
 		return $header;
182 182
 	}
Please login to merge, or discard this patch.
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['timestamp'])) {
77
+			if ($response->getStatusCode() !== 201 || is_null($json) || !is_array($json) || !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.
templates/personal_settings.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,4 +2,4 @@
 block discarded – undo
2 2
 script('twofactor_gateway', 'build');
3 3
 ?>
4 4
 
5
-<div id="twofactor-gateway-<?php print_unescaped($_['gateway']) ?>"></div>
5
+<div id="twofactor-gateway-<?php print_unescaped($_[ 'gateway' ]) ?>"></div>
Please login to merge, or discard this patch.