Skip to content

Commit 7bdd35b

Browse files
committed
chore: apply newest version of nextcloud coding-standard
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 1544735 commit 7bdd35b

15 files changed

Lines changed: 82 additions & 82 deletions

lib/Controller/SignFileController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ public function sign(string $method, array $elements = [], string $identifyValue
119119
->setLibreSignFile($libreSignFile)
120120
->setSignRequest($signRequest)
121121
->setUserUniqueIdentifier(
122-
$identifyMethod->getEntity()->getIdentifierKey() .
123-
':' .
124-
$identifyMethod->getEntity()->getIdentifierValue()
122+
$identifyMethod->getEntity()->getIdentifierKey()
123+
. ':'
124+
. $identifyMethod->getEntity()->getIdentifierValue()
125125
)
126126
->setFriendlyName($signRequest->getDisplayName())
127127
->storeUserMetadata([
@@ -167,8 +167,8 @@ public function sign(string $method, array $elements = [], string $identifyValue
167167
default:
168168
$this->logger->error($message, ['exception' => $th]);
169169
$data['errors'] = [[
170-
'message' =>
171-
sprintf(<<<MESSAGE
170+
'message'
171+
=> sprintf(<<<MESSAGE
172172
The server was unable to complete your request.
173173
If this happens again, please send the technical details below to the server administrator.
174174
## Technical details:

lib/Controller/SignatureElementsController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public function createSignatureElement(array $elements): DataResponse {
9696
return new DataResponse(
9797
[
9898
'message' => $message,
99-
'elements' =>
100-
(
99+
'elements'
100+
=> (
101101
$this->userSession->getUser() instanceof IUser
102102
? $this->signerElementsService->getUserElements($this->userSession->getUser()->getUID())
103103
: $this->signerElementsService->getElementsFromSessionAsArray()

lib/Handler/CertificateEngine/CfsslHandler.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ private function newCert(): array {
196196
private function genkey(): void {
197197
$binary = $this->getBinary();
198198
$configPath = $this->getConfigPath();
199-
$cmd = $binary . ' genkey ' .
200-
'-initca=true ' . $configPath . DIRECTORY_SEPARATOR . 'csr_server.json | ' .
201-
$binary . 'json -bare ' . $configPath . DIRECTORY_SEPARATOR . 'ca;';
199+
$cmd = $binary . ' genkey '
200+
. '-initca=true ' . $configPath . DIRECTORY_SEPARATOR . 'csr_server.json | '
201+
. $binary . 'json -bare ' . $configPath . DIRECTORY_SEPARATOR . 'ca;';
202202
shell_exec($cmd);
203203
}
204204

@@ -258,10 +258,10 @@ private function wakeUp(): void {
258258
throw new LibresignException('CFSSL not configured.');
259259
}
260260
$this->cfsslServerHandler->updateExpirity($this->expirity());
261-
$cmd = 'nohup ' . $binary . ' serve -address=127.0.0.1 ' .
262-
'-ca-key ' . $configPath . DIRECTORY_SEPARATOR . 'ca-key.pem ' .
263-
'-ca ' . $configPath . DIRECTORY_SEPARATOR . 'ca.pem ' .
264-
'-config ' . $configPath . DIRECTORY_SEPARATOR . 'config_server.json > /dev/null 2>&1 & echo $!';
261+
$cmd = 'nohup ' . $binary . ' serve -address=127.0.0.1 '
262+
. '-ca-key ' . $configPath . DIRECTORY_SEPARATOR . 'ca-key.pem '
263+
. '-ca ' . $configPath . DIRECTORY_SEPARATOR . 'ca.pem '
264+
. '-config ' . $configPath . DIRECTORY_SEPARATOR . 'config_server.json > /dev/null 2>&1 & echo $!';
265265
shell_exec($cmd);
266266
$loops = 0;
267267
while (!$this->portOpen() && $loops <= 4) {
@@ -286,10 +286,10 @@ private function portOpen(): bool {
286286

287287
private function getServerPid(): int {
288288
$cmd = 'ps -eo pid,command|';
289-
$cmd .= 'grep "cfssl.*serve.*-address"|' .
290-
'grep -v grep|' .
291-
'grep -v defunct|' .
292-
'sed -e "s/^[[:space:]]*//"|cut -d" " -f1';
289+
$cmd .= 'grep "cfssl.*serve.*-address"|'
290+
. 'grep -v grep|'
291+
. 'grep -v defunct|'
292+
. 'sed -e "s/^[[:space:]]*//"|cut -d" " -f1';
293293
$output = shell_exec($cmd);
294294
if (!is_string($output)) {
295295
return 0;

lib/Handler/CfsslServerHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ private function putCsrServer(
7272
$response = file_put_contents($this->csrServerFile, json_encode($content));
7373
if ($response === false) {
7474
throw new LibresignException(
75-
"Error while writing CSR server file.\n" .
76-
'Remove the CFSSL API URI and Config path to use the default values.',
75+
"Error while writing CSR server file.\n"
76+
. 'Remove the CFSSL API URI and Config path to use the default values.',
7777
500
7878
);
7979
}

lib/Handler/SignEngine/JSignPdfHandler.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public function getJSignParam(): JSignParam {
7979
throw new \Exception('Invalid Java binary. Run occ libresign:install --java');
8080
}
8181
$this->jSignParam->setJavaPath(
82-
$this->getEnvironments() .
83-
$javaPath .
84-
' -Duser.home=' . escapeshellarg($this->getHome()) . ' '
82+
$this->getEnvironments()
83+
. $javaPath
84+
. ' -Duser.home=' . escapeshellarg($this->getHome()) . ' '
8585
);
8686
}
8787
}
@@ -254,8 +254,8 @@ private function signUsingVisibleElements(): string {
254254
}
255255

256256
$param->setJSignParameters(
257-
$originalParam->getJSignParameters() .
258-
$this->listParamsToString($params)
257+
$originalParam->getJSignParameters()
258+
. $this->listParamsToString($params)
259259
);
260260
$jSignPdf->setParam($param);
261261
$signed = $this->signWrapper($jSignPdf);
@@ -406,8 +406,8 @@ private function signWrapper(JSignPDF $jSignPDF): string {
406406
$param = $this->getJSignParam();
407407
$param
408408
->setJSignParameters(
409-
$this->jSignParam->getJSignParameters() .
410-
' --hash-algorithm ' . $this->getHashAlgorithm()
409+
$this->jSignParam->getJSignParameters()
410+
. ' --hash-algorithm ' . $this->getHashAlgorithm()
411411
);
412412
$jSignPDF->setParam($param);
413413
return $jSignPDF->sign();

lib/Service/AccountService.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ public function deleteSignatureElement(?IUser $user, string $sessionId, int $nod
489489
*/
490490
public function uploadPfx(array $file, IUser $user): void {
491491
if (
492-
$file['error'] !== 0 ||
493-
!is_uploaded_file($file['tmp_name']) ||
494-
Filesystem::isFileBlacklisted($file['tmp_name'])
492+
$file['error'] !== 0
493+
|| !is_uploaded_file($file['tmp_name'])
494+
|| Filesystem::isFileBlacklisted($file['tmp_name'])
495495
) {
496496
// TRANSLATORS Error when the uploaded certificate file is not valid
497497
throw new InvalidArgumentException($this->l10n->t('Invalid file provided. Need to be a .pfx file.'));

lib/Service/FileService.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,9 @@ public function setFileFromRequest(?array $file): self {
195195
throw new InvalidArgumentException($this->l10n->t('No file provided'));
196196
}
197197
if (
198-
$file['error'] !== 0 ||
199-
!is_uploaded_file($file['tmp_name']) ||
200-
Filesystem::isFileBlacklisted($file['tmp_name'])
198+
$file['error'] !== 0
199+
|| !is_uploaded_file($file['tmp_name'])
200+
|| Filesystem::isFileBlacklisted($file['tmp_name'])
201201
) {
202202
unlink($file['tmp_name']);
203203
throw new InvalidArgumentException($this->l10n->t('Invalid file provided'));
@@ -736,8 +736,8 @@ private function associateAllAndFormat(IUser $user, array $files, array $signers
736736
return $carry;
737737
}, ''),
738738
'description' => $signer->getDescription(),
739-
'displayName' =>
740-
array_reduce($identifyMethodsOfSigner, function (string $carry, IdentifyMethod $identifyMethod): string {
739+
'displayName'
740+
=> array_reduce($identifyMethodsOfSigner, function (string $carry, IdentifyMethod $identifyMethod): string {
741741
if (!$carry && $identifyMethod->getMandatory()) {
742742
return $identifyMethod->getIdentifierValue();
743743
}

lib/Service/IdentifyMethod/AbstractIdentifyMethod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ private function loadSavedSettings(): void {
312312
}, []);
313313
$enabled = false;
314314
foreach ($this->availableSignatureMethods as $signatureMethodName) {
315-
$this->signatureMethods[$signatureMethodName] =
316-
$this->getEmptyInstanceOfSignatureMethodByName($signatureMethodName);
315+
$this->signatureMethods[$signatureMethodName]
316+
= $this->getEmptyInstanceOfSignatureMethodByName($signatureMethodName);
317317
if (isset($this->settings['signatureMethods'][$signatureMethodName]['enabled'])
318318
&& $this->settings['signatureMethods'][$signatureMethodName]['enabled']
319319
) {

lib/Service/Install/InstallService.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ private function getFolder(string $path = '', ?ISimpleFolder $folder = null, $ne
119119
} catch (NotPermittedException $e) {
120120
$user = posix_getpwuid(posix_getuid());
121121
throw new LibresignException(
122-
$e->getMessage() . '. ' .
123-
'Permission problems. ' .
124-
'Maybe this could fix: chown -R ' . $user['name'] . ' ' . $this->getInternalPathOfFolder($folder)
122+
$e->getMessage() . '. '
123+
. 'Permission problems. '
124+
. 'Maybe this could fix: chown -R ' . $user['name'] . ' ' . $this->getInternalPathOfFolder($folder)
125125
);
126126
}
127127
}
@@ -304,10 +304,10 @@ private function getInstallPid(int $pid = 0): int {
304304
} else {
305305
$cmd = 'ps -eo pid,command|';
306306
}
307-
$cmd .= 'grep "libresign:install --' . $this->resource . '"|' .
308-
'grep -v grep|' .
309-
'grep -v defunct|' .
310-
'sed -e "s/^[[:space:]]*//"|cut -d" " -f1';
307+
$cmd .= 'grep "libresign:install --' . $this->resource . '"|'
308+
. 'grep -v grep|'
309+
. 'grep -v defunct|'
310+
. 'sed -e "s/^[[:space:]]*//"|cut -d" " -f1';
311311
$output = shell_exec($cmd);
312312
if (!is_string($output)) {
313313
return 0;

lib/Service/SignatureTextService.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,17 @@ private function splitAndGetLongestHalfLength(string $text): int {
274274
$index = $middle;
275275

276276
while (
277-
$index >= 0 &&
278-
$index < $length &&
279-
mb_substr($text, $index, 1) !== ' '
277+
$index >= 0
278+
&& $index < $length
279+
&& mb_substr($text, $index, 1) !== ' '
280280
) {
281281
$index += $direction;
282282
}
283283

284284
if (
285-
$index > 0 &&
286-
$index < $length &&
287-
mb_substr($text, $index, 1) === ' '
285+
$index > 0
286+
&& $index < $length
287+
&& mb_substr($text, $index, 1) === ' '
288288
) {
289289
$first = mb_substr($text, 0, $index);
290290
$second = mb_substr($text, $index + 1);

0 commit comments

Comments
 (0)