Passed
Push — master ( 4a3346...dd13f3 )
by
unknown
01:43
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/AppInfo/Application.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 class Application extends App implements IBootstrap {
20 20
 	public const APP_ID = 'twofactor_gateway';
21 21
 
22
-	public function __construct(array $urlParams = []) {
22
+	public function __construct(array $urlParams = [ ]) {
23 23
 		parent::__construct(self::APP_ID, $urlParams);
24 24
 	}
25 25
 
26
-	#[\Override]
26
+	#[\Override ]
27 27
 	public function register(IRegistrationContext $context): void {
28 28
 		$providerFactory = Server::get(Factory::class);
29 29
 		$fqcn = $providerFactory->getFqcnList();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		}
33 33
 	}
34 34
 
35
-	#[\Override]
35
+	#[\Override ]
36 36
 	public function boot(IBootContext $context): void {
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
lib/Provider/Factory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@
 block discarded – undo
10 10
 namespace OCA\TwoFactorGateway\Provider;
11 11
 
12 12
 class Factory extends AFactory {
13
-	#[\Override]
13
+	#[\Override ]
14 14
 	protected function getPrefix(): string {
15 15
 		return 'OCA\\TwoFactorGateway\\Provider\\Channel\\';
16 16
 	}
17 17
 
18
-	#[\Override]
18
+	#[\Override ]
19 19
 	protected function getSuffix(): string {
20 20
 		return 'Provider';
21 21
 	}
22 22
 
23
-	#[\Override]
23
+	#[\Override ]
24 24
 	protected function getBaseClass(): string {
25 25
 		return AProvider::class;
26 26
 	}
Please login to merge, or discard this patch.
lib/Provider/AProvider.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	protected IGateway $gateway;
38 38
 
39 39
 	private function getSessionKey(): string {
40
-		return 'twofactor_gateway_' . $this->getGatewayName() . '_secret';
40
+		return 'twofactor_gateway_'.$this->getGatewayName().'_secret';
41 41
 	}
42 42
 
43 43
 	public function __construct(
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 		}
59 59
 		$fqcn = static::class;
60 60
 		$parts = explode('\\', $fqcn);
61
-		[$name] = array_slice($parts, -2, 1);
61
+		[ $name ] = array_slice($parts, -2, 1);
62 62
 		$this->gatewayName = strtolower($name);
63 63
 		return $this->gatewayName;
64 64
 	}
65 65
 
66
-	#[\Override]
66
+	#[\Override ]
67 67
 	public function getId(): string {
68
-		return 'gateway_' . $this->getGatewayName();
68
+		return 'gateway_'.$this->getGatewayName();
69 69
 	}
70 70
 
71 71
 	private function getSecret(): string {
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		return $secret;
80 80
 	}
81 81
 
82
-	#[\Override]
82
+	#[\Override ]
83 83
 	public function getTemplate(IUser $user): ITemplate {
84 84
 		$secret = $this->getSecret();
85 85
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				$this->l10n->t('%s is your Nextcloud authentication code', [
92 92
 					$secret
93 93
 				]),
94
-				['code' => $secret],
94
+				[ 'code' => $secret ],
95 95
 			);
96 96
 		} catch (MessageTransmissionException) {
97 97
 			return $this->templateManager->getTemplate('twofactor_gateway', 'error');
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		return $tmpl;
103 103
 	}
104 104
 
105
-	#[\Override]
105
+	#[\Override ]
106 106
 	public function verifyChallenge(IUser $user, string $challenge): bool {
107 107
 		$valid = $this->session->exists($this->getSessionKey())
108 108
 			&& $this->session->get($this->getSessionKey()) === $challenge;
@@ -114,31 +114,31 @@  discard block
 block discarded – undo
114 114
 		return $valid;
115 115
 	}
116 116
 
117
-	#[\Override]
117
+	#[\Override ]
118 118
 	public function isTwoFactorAuthEnabledForUser(IUser $user): bool {
119 119
 		return $this->stateStorage->get($user, $this->getGatewayName())->getState() === StateStorage::STATE_ENABLED;
120 120
 	}
121 121
 
122
-	#[\Override]
122
+	#[\Override ]
123 123
 	public function getPersonalSettings(IUser $user): IPersonalProviderSettings {
124
-		$this->initialState->provideInitialState('settings-' . $this->gateway->getProviderId(), $this->gateway->getSettings());
124
+		$this->initialState->provideInitialState('settings-'.$this->gateway->getProviderId(), $this->gateway->getSettings());
125 125
 		return new PersonalSettings(
126 126
 			$this->getGatewayName(),
127 127
 			$this->gateway->isComplete(),
128 128
 		);
129 129
 	}
130 130
 
131
-	#[\Override]
131
+	#[\Override ]
132 132
 	public function getLightIcon(): String {
133 133
 		return Server::get(IURLGenerator::class)->imagePath(Application::APP_ID, 'app.svg');
134 134
 	}
135 135
 
136
-	#[\Override]
136
+	#[\Override ]
137 137
 	public function getDarkIcon(): String {
138 138
 		return Server::get(IURLGenerator::class)->imagePath(Application::APP_ID, 'app-dark.svg');
139 139
 	}
140 140
 
141
-	#[\Override]
141
+	#[\Override ]
142 142
 	public function disableFor(IUser $user) {
143 143
 		$state = $this->stateStorage->get($user, $this->getGatewayName());
144 144
 		if ($state->getState() === StateStorage::STATE_ENABLED) {
Please login to merge, or discard this patch.
lib/Provider/Gateway/TConfigurable.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	public function __call(string $name, array $args) {
22 22
 		if (!preg_match('/^(?<operation>get|set|delete)(?<field>[A-Z][A-Za-z0-9_]*)$/', $name, $matches)) {
23
-			throw new ConfigurationException('Invalid method ' . $name);
23
+			throw new ConfigurationException('Invalid method '.$name);
24 24
 		}
25
-		$field = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $matches['field']));
25
+		$field = strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $matches[ 'field' ]));
26 26
 		$key = $this->keyFromField($field);
27 27
 
28
-		switch ($matches['operation']) {
28
+		switch ($matches[ 'operation' ]) {
29 29
 			case 'get':
30 30
 				$val = (string)$this->getAppConfig()->getValueString(Application::APP_ID, $key, '');
31 31
 				if ($val === '') {
32
-					throw new ConfigurationException('No value set for ' . $field);
32
+					throw new ConfigurationException('No value set for '.$field);
33 33
 				}
34 34
 				return $val;
35 35
 
36 36
 			case 'set':
37
-				$this->getAppConfig()->setValueString(Application::APP_ID, $key, (string)($args[0] ?? ''));
37
+				$this->getAppConfig()->setValueString(Application::APP_ID, $key, (string)($args[ 0 ] ?? ''));
38 38
 				return $this;
39 39
 
40 40
 			case 'delete':
41 41
 				$this->getAppConfig()->deleteKey(Application::APP_ID, $key);
42 42
 				return $this;
43 43
 		}
44
-		throw new ConfigurationException('Invalid operation ' . $matches['operation']);
44
+		throw new ConfigurationException('Invalid operation '.$matches[ 'operation' ]);
45 45
 	}
46 46
 
47 47
 	/**
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	private function keyFromField(string $field): string {
51 51
 		$fields = array_column($this->getSchemaFields(), 'field');
52 52
 		if (!in_array($field, $fields, true)) {
53
-			throw new ConfigurationException('Invalid configuration field: ' . $field . ', check SCHEMA at ' . static::class);
53
+			throw new ConfigurationException('Invalid configuration field: '.$field.', check SCHEMA at '.static::class);
54 54
 		}
55
-		return $this->getProviderId() . '_' . $field;
55
+		return $this->getProviderId().'_'.$field;
56 56
 	}
57 57
 
58 58
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @throws ConfigurationException
71 71
 	 */
72 72
 	protected function getSchemaFields(): array {
73
-		return static::getSchema()['fields'];
73
+		return static::getSchema()[ 'fields' ];
74 74
 	}
75 75
 
76 76
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @throws ConfigurationException
79 79
 	 */
80 80
 	public static function getSchema(): array {
81
-		if (!defined(static::class . '::SCHEMA')) {
81
+		if (!defined(static::class.'::SCHEMA')) {
82 82
 			throw new ConfigurationException('No SCHEMA defined');
83 83
 		}
84 84
 		return static::SCHEMA;
Please login to merge, or discard this patch.
lib/Provider/Channel/Signal/Provider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@
 block discarded – undo
13 13
 
14 14
 class Provider extends AProvider {
15 15
 
16
-	#[\Override]
16
+	#[\Override ]
17 17
 	public function getDisplayName(): string {
18 18
 		return $this->l10n->t('Signal verification');
19 19
 	}
20 20
 
21
-	#[\Override]
21
+	#[\Override ]
22 22
 	public function getDescription(): string {
23 23
 		return $this->l10n->t('Authenticate via Signal');
24 24
 	}
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/ClickatellCentral.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 		'id' => 'clickatell_central',
29 29
 		'name' => 'Clickatell Central',
30 30
 		'fields' => [
31
-			['field' => 'api',      'prompt' => 'Please enter your central.clickatell.com API-ID:'],
32
-			['field' => 'user',     'prompt' => 'Please enter your central.clickatell.com username:'],
33
-			['field' => 'password', 'prompt' => 'Please enter your central.clickatell.com password:'],
31
+			[ 'field' => 'api', 'prompt' => 'Please enter your central.clickatell.com API-ID:' ],
32
+			[ 'field' => 'user', 'prompt' => 'Please enter your central.clickatell.com username:' ],
33
+			[ 'field' => 'password', 'prompt' => 'Please enter your central.clickatell.com password:' ],
34 34
 		],
35 35
 	];
36 36
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$this->client = $clientService->newClient();
43 43
 	}
44 44
 
45
-	#[\Override]
45
+	#[\Override ]
46 46
 	public function send(string $identifier, string $message) {
47 47
 		try {
48 48
 			$response = $this->client->get(vsprintf('https://api.clickatell.com/http/sendmsg?user=%s&password=%s&api_id=%u&to=%s&text=%s', [
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SMSGlobal.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	public const SCHEMA = [
28 28
 		'name' => 'SMSGlobal',
29 29
 		'fields' => [
30
-			['field' => 'url',      'prompt' => 'Please enter your SMSGlobal http-api:', 'default' => 'https://api.smsglobal.com/http-api.php'],
31
-			['field' => 'user',     'prompt' => 'Please enter your SMSGlobal username (for http-api):'],
32
-			['field' => 'password', 'prompt' => 'Please enter your SMSGlobal password (for http-api):'],
30
+			[ 'field' => 'url', 'prompt' => 'Please enter your SMSGlobal http-api:', 'default' => 'https://api.smsglobal.com/http-api.php' ],
31
+			[ 'field' => 'user', 'prompt' => 'Please enter your SMSGlobal username (for http-api):' ],
32
+			[ 'field' => 'password', 'prompt' => 'Please enter your SMSGlobal password (for http-api):' ],
33 33
 		],
34 34
 	];
35 35
 	private IClient $client;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		$this->client = $clientService->newClient();
41 41
 	}
42 42
 
43
-	#[\Override]
43
+	#[\Override ]
44 44
 	public function send(string $identifier, string $message) {
45 45
 		$to = str_replace('+', '', $identifier);
46 46
 
Please login to merge, or discard this patch.
lib/Provider/Channel/SMS/Provider/Drivers/SpryngSMS.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	public const SCHEMA = [
24 24
 		'name' => 'Spryng',
25 25
 		'fields' => [
26
-			['field' => 'apitoken', 'prompt' => 'Please enter your Spryng api token:'],
26
+			[ 'field' => 'apitoken', 'prompt' => 'Please enter your Spryng api token:' ],
27 27
 		],
28 28
 	];
29 29
 	private IClient $client;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		$this->client = $clientService->newClient();
35 35
 	}
36 36
 
37
-	#[\Override]
37
+	#[\Override ]
38 38
 	public function send(string $identifier, string $message) {
39 39
 		try {
40 40
 			$this->client->post(
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 				[
43 43
 					'headers' => [
44 44
 						'Accept' => 'application/json',
45
-						'Authorization' => 'Bearer ' . $this->getApitoken(),
45
+						'Authorization' => 'Bearer '.$this->getApitoken(),
46 46
 						'Content-Type' => 'application/json',
47 47
 					],
48 48
 					'json' => [
49 49
 						'body' => $message,
50 50
 						'encoding' => 'plain',
51 51
 						'originator' => 'Nextcloud',
52
-						'recipients' => [$identifier],
52
+						'recipients' => [ $identifier ],
53 53
 						'route' => '1',
54 54
 					],
55 55
 				]
Please login to merge, or discard this patch.