@@ -59,18 +59,18 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | $shares = $this->shareByCircleProvider->getSharesToCircle($teamId); |
| 62 | - usort($shares, function ($a, $b) { |
|
| 62 | + usort($shares, function($a, $b) { |
|
| 63 | 63 | return (int)($b->getItemType() === 'folder') - (int)($a->getItemType() === 'folder'); |
| 64 | 64 | }); |
| 65 | - return array_map(function (ShareWrapper $shareWrapper) { |
|
| 65 | + return array_map(function(ShareWrapper $shareWrapper) { |
|
| 66 | 66 | $isFolder = $shareWrapper->getItemType() === 'folder'; |
| 67 | 67 | return new TeamResource( |
| 68 | 68 | $this, |
| 69 | 69 | (string)$shareWrapper->getFileSource(), |
| 70 | 70 | basename($shareWrapper->getFileTarget()), |
| 71 | - $this->urlGenerator->getAbsoluteURL('/index.php/f/' . $shareWrapper->getFileSource()), |
|
| 71 | + $this->urlGenerator->getAbsoluteURL('/index.php/f/'.$shareWrapper->getFileSource()), |
|
| 72 | 72 | iconSvg: $isFolder ? '<svg xmlns="http://www.w3.org/2000/svg" id="mdi-folder" viewBox="0 0 24 24"><path d="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z" /></svg>' : null, |
| 73 | - iconURL: !$isFolder ? |
|
| 73 | + iconURL : !$isFolder ? |
|
| 74 | 74 | $this->urlGenerator->linkToRouteAbsolute('core.preview.getPreviewByFileId', ['fileId' => $shareWrapper->getFileSource(), 'mimeFallback' => true, ]) |
| 75 | 75 | : null, |
| 76 | 76 | ); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - return count(array_filter($this->getSharedWith($teamId), function (TeamResource $resource) use ($resourceId) { |
|
| 85 | + return count(array_filter($this->getSharedWith($teamId), function(TeamResource $resource) use ($resourceId) { |
|
| 86 | 86 | return $resource->getId() === $resourceId; |
| 87 | 87 | })) !== 0; |
| 88 | 88 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $shares = $this->shareByCircleProvider->getSharesByFileId((int)$resourceId); |
| 96 | 96 | |
| 97 | - return array_map(function ($share) { |
|
| 97 | + return array_map(function($share) { |
|
| 98 | 98 | return $share->getSharedWith(); |
| 99 | 99 | }, $shares); |
| 100 | 100 | } |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | continue; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $replace['{' . $k . '}'] = $data[$k]['_parsed']; |
|
| 128 | + $replace['{'.$k.'}'] = $data[$k]['_parsed']; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $event->setParsedSubject(strtr($line, $replace)); |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | return array_filter( |
| 444 | 444 | array_map( |
| 445 | - function (ShareWrapper $wrapper) { |
|
| 445 | + function(ShareWrapper $wrapper) { |
|
| 446 | 446 | return $wrapper->getShare($this->rootFolder, $this->userManager, $this->urlGenerator); |
| 447 | 447 | }, $wrappedShares |
| 448 | 448 | ) |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | |
| 495 | 495 | return array_filter( |
| 496 | 496 | array_map( |
| 497 | - function (ShareWrapper $wrapper) { |
|
| 497 | + function(ShareWrapper $wrapper) { |
|
| 498 | 498 | return $wrapper->getShare($this->rootFolder, $this->userManager, $this->urlGenerator); |
| 499 | 499 | }, $wrappedShares |
| 500 | 500 | ) |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | return array_filter( |
| 545 | 545 | array_map( |
| 546 | - function (ShareWrapper $wrapper) { |
|
| 546 | + function(ShareWrapper $wrapper) { |
|
| 547 | 547 | return $wrapper->getShare( |
| 548 | 548 | $this->rootFolder, $this->userManager, $this->urlGenerator, true |
| 549 | 549 | ); |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | |
| 575 | 575 | $share = $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator); |
| 576 | 576 | if ($share->getPassword() !== '') { |
| 577 | - $this->logger->notice('share is protected by a password, hash: ' . $share->getPassword()); |
|
| 577 | + $this->logger->notice('share is protected by a password, hash: '.$share->getPassword()); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | return $share; |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | ]; |
| 685 | 685 | } else { |
| 686 | 686 | // we only store temp value, as token is unknown at this point |
| 687 | - $remote[$member->getUserid() . '@' . $member->getInstance()] = [ |
|
| 687 | + $remote[$member->getUserid().'@'.$member->getInstance()] = [ |
|
| 688 | 688 | 'node_id' => $share->getFileSource(), |
| 689 | 689 | 'shareId' => $share->getId(), |
| 690 | 690 | 'memberId' => $member->getId(), |
@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | throw new SignatureException('missing elements in \'headers\''); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $target = strtolower($request->getMethod()) . ' ' . $request->getRequestUri(); |
|
| 200 | - $estimated = ['(request-target): ' . $target]; |
|
| 199 | + $target = strtolower($request->getMethod()).' '.$request->getRequestUri(); |
|
| 200 | + $estimated = ['(request-target): '.$target]; |
|
| 201 | 201 | |
| 202 | 202 | foreach ($headers as $key) { |
| 203 | 203 | $value = $request->getHeader($key); |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | throw new SignatureException('empty elements in \'headers\''); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - $estimated[] = $key . ': ' . $value; |
|
| 211 | + $estimated[] = $key.': '.$value; |
|
| 212 | 212 | } |
| 213 | 213 | $signedRequest->setClearSignature(implode("\n", $estimated)); |
| 214 | 214 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $request = $signedRequest->getOutgoingRequest(); |
| 281 | 281 | |
| 282 | 282 | $data = new SimpleDataStore(); |
| 283 | - $data->s('(request-target)', NCRequest::method($request->getType()) . ' ' . $request->getPath()) |
|
| 283 | + $data->s('(request-target)', NCRequest::method($request->getType()).' '.$request->getPath()) |
|
| 284 | 284 | ->sInt('content-length', strlen($signedRequest->getBody())) |
| 285 | 285 | ->s('date', gmdate($this->dateHeader)) |
| 286 | 286 | ->s('digest', $signedRequest->getDigest()) |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | foreach ($data->keys() as $element) { |
| 300 | 300 | try { |
| 301 | 301 | $value = $data->gItem($element); |
| 302 | - $signing[] = $element . ': ' . $value; |
|
| 302 | + $signing[] = $element.': '.$value; |
|
| 303 | 303 | if ($element !== '(request-target)') { |
| 304 | 304 | $signedRequest->getOutgoingRequest()->addHeader($element, $value); |
| 305 | 305 | } |
@@ -332,10 +332,10 @@ discard block |
||
| 332 | 332 | $headers = array_diff($signedRequest->getSignatureHeader()->keys(), ['(request-target)']); |
| 333 | 333 | $signatory = $signedRequest->getSignatory(); |
| 334 | 334 | $signatureElements = [ |
| 335 | - 'keyId="' . $signatory->getKeyId() . '"', |
|
| 336 | - 'algorithm="' . $this->getChosenEncryption($signatory) . '"', |
|
| 337 | - 'headers="' . implode(' ', $headers) . '"', |
|
| 338 | - 'signature="' . $signedRequest->getSignedSignature() . '"' |
|
| 335 | + 'keyId="'.$signatory->getKeyId().'"', |
|
| 336 | + 'algorithm="'.$this->getChosenEncryption($signatory).'"', |
|
| 337 | + 'headers="'.implode(' ', $headers).'"', |
|
| 338 | + 'signature="'.$signedRequest->getSignedSignature().'"' |
|
| 339 | 339 | ]; |
| 340 | 340 | |
| 341 | 341 | $signedRequest->getOutgoingRequest()->addHeader('Signature', implode(',', $signatureElements)); |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | */ |
| 116 | 116 | public function setBody(string $body): self { |
| 117 | 117 | $this->body = $body; |
| 118 | - $this->setDigest('SHA-256=' . base64_encode(hash('sha256', utf8_encode($body), true))); |
|
| 118 | + $this->setDigest('SHA-256='.base64_encode(hash('sha256', utf8_encode($body), true))); |
|
| 119 | 119 | |
| 120 | 120 | return $this; |
| 121 | 121 | } |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | if ($check) { |
| 509 | 509 | $user = $this->userManager->get($userId); |
| 510 | 510 | if ($user === null) { |
| 511 | - throw new FederatedUserNotFoundException('user ' . $userId . ' not found'); |
|
| 511 | + throw new FederatedUserNotFoundException('user '.$userId.' not found'); |
|
| 512 | 512 | } |
| 513 | 513 | $displayName = $this->userManager->getDisplayName($userId); |
| 514 | 514 | } else { |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | $prefix = ($federatedUser->getUserType() === Member::TYPE_APP) ? 'app' |
| 1024 | 1024 | : Member::$TYPE[$federatedUser->getUserType()]; |
| 1025 | 1025 | |
| 1026 | - $circle->setName($prefix . ':' . $federatedUser->getUserId() . ':' . $id) |
|
| 1026 | + $circle->setName($prefix.':'.$federatedUser->getUserId().':'.$id) |
|
| 1027 | 1027 | ->setDisplayName($federatedUser->getDisplayName()) |
| 1028 | 1028 | ->setSingleId($id) |
| 1029 | 1029 | ->setSource($source); |
@@ -1227,7 +1227,7 @@ discard block |
||
| 1227 | 1227 | $owner = $this->getCurrentApp(); |
| 1228 | 1228 | |
| 1229 | 1229 | $circle = new Circle(); |
| 1230 | - $circle->setName('group:' . $groupId) |
|
| 1230 | + $circle->setName('group:'.$groupId) |
|
| 1231 | 1231 | ->setConfig(Circle::CFG_SYSTEM | Circle::CFG_NO_OWNER | Circle::CFG_HIDDEN) |
| 1232 | 1232 | ->setSingleId($this->token(ManagedModel::ID_LENGTH)) |
| 1233 | 1233 | ->setSource(Member::TYPE_GROUP); |
@@ -1295,8 +1295,8 @@ discard block |
||
| 1295 | 1295 | * @return string |
| 1296 | 1296 | */ |
| 1297 | 1297 | private function generateCacheKey(FederatedUser $federatedUser): string { |
| 1298 | - return $federatedUser->getInstance() . '#' |
|
| 1299 | - . $federatedUser->getUserType() . '#' |
|
| 1298 | + return $federatedUser->getInstance().'#' |
|
| 1299 | + . $federatedUser->getUserType().'#' |
|
| 1300 | 1300 | . $federatedUser->getUserId(); |
| 1301 | 1301 | } |
| 1302 | 1302 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | // $app->setAlgorithm(NCSignatory::SHA512); |
| 267 | 267 | $signedRequest = $this->signOutgoingRequest($request, $app); |
| 268 | 268 | $this->doRequest($signedRequest->getOutgoingRequest(), false); |
| 269 | - } catch (RequestNetworkException|SignatoryException $e) { |
|
| 269 | + } catch (RequestNetworkException | SignatoryException $e) { |
|
| 270 | 270 | throw new RemoteInstanceException($e->getMessage()); |
| 271 | 271 | } |
| 272 | 272 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | public function getCachedRemoteInstance(string $instance): RemoteInstance { |
| 311 | 311 | $remoteInstance = $this->remoteRequest->getFromInstance($instance); |
| 312 | 312 | if ($remoteInstance->getType() === RemoteInstance::TYPE_UNKNOWN) { |
| 313 | - throw new UnknownRemoteException($instance . ' is set as \'unknown\' in database'); |
|
| 313 | + throw new UnknownRemoteException($instance.' is set as \'unknown\' in database'); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | return $remoteInstance; |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | $test = new ReflectionClass($class); |
| 500 | 500 | $this->confirmFederatedItemExceptionFromClass($test); |
| 501 | 501 | $e = $class; |
| 502 | - } catch (ReflectionException|FederatedItemException $_e) { |
|
| 502 | + } catch (ReflectionException | FederatedItemException $_e) { |
|
| 503 | 503 | $e = $this->getFederatedItemExceptionFromStatus($result->getStatusCode()); |
| 504 | 504 | } |
| 505 | 505 | |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | * @throws RemoteNotFoundException |
| 554 | 554 | * @throws RemoteUidException |
| 555 | 555 | */ |
| 556 | - public function confirmValidRemote(RemoteInstance $remote, ?RemoteInstance &$stored = null): void { |
|
| 556 | + public function confirmValidRemote(RemoteInstance $remote, ?RemoteInstance & $stored = null): void { |
|
| 557 | 557 | try { |
| 558 | 558 | $stored = $this->remoteRequest->getFromHref($remote->getId()); |
| 559 | 559 | } catch (RemoteNotFoundException $e) { |
@@ -324,8 +324,8 @@ |
||
| 324 | 324 | int $nodeId, |
| 325 | 325 | string $probeSum, |
| 326 | 326 | ): string { |
| 327 | - return $federatedUser->getSingleId() . '#' |
|
| 328 | - . $nodeId . '#' |
|
| 327 | + return $federatedUser->getSingleId().'#' |
|
| 328 | + . $nodeId.'#' |
|
| 329 | 329 | . $probeSum; |
| 330 | 330 | } |
| 331 | 331 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | try { |
| 93 | 93 | $this->circleRequest->getFederatedUserBySingleId($singleId); |
| 94 | - } catch (FederatedUserNotFoundException|OwnerNotFoundException $e) { |
|
| 94 | + } catch (FederatedUserNotFoundException | OwnerNotFoundException $e) { |
|
| 95 | 95 | $this->membershipRequest->removeBySingleId($singleId); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | private function getChildrenMembers(string $id, array &$knownIds = []): array { |
| 244 | 244 | $singleIds = array_map( |
| 245 | - function (Member $item): string { |
|
| 245 | + function(Member $item): string { |
|
| 246 | 246 | return $item->getSingleId(); |
| 247 | 247 | }, $this->memberRequest->getMembers($id) |
| 248 | 248 | ); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function getChildrenMemberships(string $id, array &$knownIds = []): array { |
| 268 | 268 | $singleIds = array_map( |
| 269 | - function (Membership $item): string { |
|
| 269 | + function(Membership $item): string { |
|
| 270 | 270 | return $item->getSingleId(); |
| 271 | 271 | }, $this->membershipRequest->getInherited($id) |
| 272 | 272 | ); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | private function removeDeprecatedMemberships(array $memberships, array $known): array { |
| 322 | 322 | $circleIds = array_map( |
| 323 | - function (Membership $membership): string { |
|
| 323 | + function(Membership $membership): string { |
|
| 324 | 324 | return $membership->getCircleId(); |
| 325 | 325 | }, $memberships |
| 326 | 326 | ); |