@@ -58,9 +58,9 @@ |
||
58 | 58 | public function search(string $query, array $inApps = [], int $page = 1, int $size = 30): JSONResponse { |
59 | 59 | $results = $this->searcher->searchPaged($query, $inApps, $page, $size); |
60 | 60 | |
61 | - $results = array_filter($results, function (Result $result) { |
|
61 | + $results = array_filter($results, function(Result $result) { |
|
62 | 62 | if (json_encode($result, JSON_HEX_TAG) === false) { |
63 | - $this->logger->warning("Skipping search result due to invalid encoding: {type: " . $result->type . ", id: " . $result->id . "}"); |
|
63 | + $this->logger->warning("Skipping search result due to invalid encoding: {type: ".$result->type.", id: ".$result->id."}"); |
|
64 | 64 | return false; |
65 | 65 | } else { |
66 | 66 | return true; |
@@ -43,7 +43,7 @@ |
||
43 | 43 | |
44 | 44 | public function injectFn(callable $fn) { |
45 | 45 | $reflected = new ReflectionFunction(Closure::fromCallable($fn)); |
46 | - return $fn(...array_map(function (ReflectionParameter $param) { |
|
46 | + return $fn(...array_map(function(ReflectionParameter $param) { |
|
47 | 47 | // First we try by type (more likely these days) |
48 | 48 | if (($type = $param->getType()) !== null) { |
49 | 49 | try { |
@@ -60,11 +60,11 @@ |
||
60 | 60 | if ($readablePath) { |
61 | 61 | $message = "\"$path\"(\"$readablePath\") is locked"; |
62 | 62 | } else { |
63 | - $message = '"' . $path . '" is locked'; |
|
63 | + $message = '"'.$path.'" is locked'; |
|
64 | 64 | } |
65 | 65 | $this->existingLock = $existingLock; |
66 | 66 | if ($existingLock) { |
67 | - $message .= ', existing lock on file: ' . $existingLock; |
|
67 | + $message .= ', existing lock on file: '.$existingLock; |
|
68 | 68 | } |
69 | 69 | parent::__construct($message, 0, $previous); |
70 | 70 | $this->path = $path; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $linkCheckPlugin = new \OCA\DAV\Files\Sharing\PublicLinkCheckPlugin(); |
65 | 65 | $filesDropPlugin = new \OCA\DAV\Files\Sharing\FilesDropPlugin(); |
66 | 66 | |
67 | -$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function (\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) { |
|
67 | +$server = $serverFactory->createServer($baseuri, $requestUri, $authPlugin, function(\Sabre\DAV\Server $server) use ($authBackend, $linkCheckPlugin, $filesDropPlugin) { |
|
68 | 68 | $isAjax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] === 'XMLHttpRequest'); |
69 | 69 | /** @var \OCA\FederatedFileSharing\FederatedShareProvider $shareProvider */ |
70 | 70 | $federatedShareProvider = \OC::$server->query(\OCA\FederatedFileSharing\FederatedShareProvider::class); |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | |
81 | 81 | // FIXME: should not add storage wrappers outside of preSetup, need to find a better way |
82 | 82 | $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); |
83 | - \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) { |
|
83 | + \OC\Files\Filesystem::addStorageWrapper('sharePermissions', function($mountPoint, $storage) use ($share) { |
|
84 | 84 | return new \OC\Files\Storage\Wrapper\PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE]); |
85 | 85 | }); |
86 | - \OC\Files\Filesystem::addStorageWrapper('shareOwner', function ($mountPoint, $storage) use ($share) { |
|
86 | + \OC\Files\Filesystem::addStorageWrapper('shareOwner', function($mountPoint, $storage) use ($share) { |
|
87 | 87 | return new \OCA\DAV\Storage\PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]); |
88 | 88 | }); |
89 | 89 | \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog); |
90 | 90 | |
91 | 91 | OC_Util::tearDownFS(); |
92 | 92 | OC_Util::setupFS($owner); |
93 | - $ownerView = new \OC\Files\View('/'. $owner . '/files'); |
|
93 | + $ownerView = new \OC\Files\View('/'.$owner.'/files'); |
|
94 | 94 | $path = $ownerView->getPath($fileId); |
95 | 95 | $fileInfo = $ownerView->getFileInfo($path); |
96 | 96 | $linkCheckPlugin->setFileInfo($fileInfo); |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | private function loadCustomDefinitions(string $fileName, array $definitions): array { |
129 | - if (file_exists($this->customConfigDir . '/' . $fileName)) { |
|
130 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/' . $fileName), true); |
|
129 | + if (file_exists($this->customConfigDir.'/'.$fileName)) { |
|
130 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/'.$fileName), true); |
|
131 | 131 | if (json_last_error() === JSON_ERROR_NONE) { |
132 | 132 | $definitions = array_merge($definitions, $custom); |
133 | 133 | } else { |
134 | - $this->logger->warning('Failed to parse ' . $fileName . ': ' . json_last_error_msg()); |
|
134 | + $this->logger->warning('Failed to parse '.$fileName.': '.json_last_error_msg()); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | return $definitions; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
148 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
149 | 149 | $this->mimeTypeAlias = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEALIASES, $this->mimeTypeAlias); |
150 | 150 | } |
151 | 151 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | public function getOnlyDefaultAliases(): array { |
161 | 161 | $this->loadMappings(); |
162 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
162 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
163 | 163 | return $this->mimeTypeAlias; |
164 | 164 | } |
165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
174 | - $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypemapping.dist.json'), true); |
|
174 | + $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypemapping.dist.json'), true); |
|
175 | 175 | $mimetypeMapping = $this->loadCustomDefinitions(self::CUSTOM_MIMETYPEMAPPING, $mimetypeMapping); |
176 | 176 | |
177 | 177 | $this->registerTypeArray($mimetypeMapping); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | // Icon exists? |
368 | 368 | try { |
369 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg'); |
|
369 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$icon.'.svg'); |
|
370 | 370 | return $this->mimetypeIcons[$mimetype]; |
371 | 371 | } catch (\RuntimeException $e) { |
372 | 372 | // Specified image not found |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if (strpos($icon, '-')) { |
378 | 378 | $mimePart = substr($icon, 0, strpos($icon, '-')); |
379 | 379 | try { |
380 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg'); |
|
380 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$mimePart.'.svg'); |
|
381 | 381 | return $this->mimetypeIcons[$mimetype]; |
382 | 382 | } catch (\RuntimeException $e) { |
383 | 383 | // Image for the first part of the mimetype not found |
@@ -50,7 +50,7 @@ |
||
50 | 50 | $eventName = 'OCA\Files_Sharing::loadAdditionalScripts'; |
51 | 51 | |
52 | 52 | if ($event->getScope() !== null) { |
53 | - $eventName .= '::' . $event->getScope(); |
|
53 | + $eventName .= '::'.$event->getScope(); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $legacyEvent = new GenericEvent(null, ['share' => $event->getShare()]); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | if (isset($this->namespaces[$namespace])) { |
105 | 105 | if (!isset($this->hasNoAppContainer[$namespace])) { |
106 | - $applicationClassName = 'OCA\\' . $sensitiveNamespace . '\\AppInfo\\Application'; |
|
106 | + $applicationClassName = 'OCA\\'.$sensitiveNamespace.'\\AppInfo\\Application'; |
|
107 | 107 | if (class_exists($applicationClassName)) { |
108 | 108 | $app = new $applicationClassName(); |
109 | 109 | if (isset($this->appContainers[$namespace])) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | try { |
162 | - [,$namespace,] = explode('\\', $id); |
|
162 | + [,$namespace, ] = explode('\\', $id); |
|
163 | 163 | return $this->getAppContainer(strtolower($namespace), $namespace); |
164 | 164 | } catch (QueryException $e) { |
165 | 165 | return null; |
@@ -115,68 +115,68 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * Core services |
117 | 117 | */ |
118 | - $this->registerService(IOutput::class, function () { |
|
118 | + $this->registerService(IOutput::class, function() { |
|
119 | 119 | return new Output($this->getServer()->getWebRoot()); |
120 | 120 | }); |
121 | 121 | |
122 | - $this->registerService(Folder::class, function () { |
|
122 | + $this->registerService(Folder::class, function() { |
|
123 | 123 | return $this->getServer()->getUserFolder(); |
124 | 124 | }); |
125 | 125 | |
126 | - $this->registerService(IAppData::class, function (ContainerInterface $c) { |
|
126 | + $this->registerService(IAppData::class, function(ContainerInterface $c) { |
|
127 | 127 | return $this->getServer()->getAppDataDir($c->get('AppName')); |
128 | 128 | }); |
129 | 129 | |
130 | - $this->registerService(IL10N::class, function (ContainerInterface $c) { |
|
130 | + $this->registerService(IL10N::class, function(ContainerInterface $c) { |
|
131 | 131 | return $this->getServer()->getL10N($c->get('AppName')); |
132 | 132 | }); |
133 | 133 | |
134 | 134 | // Log wrappers |
135 | - $this->registerService(LoggerInterface::class, function (ContainerInterface $c) { |
|
135 | + $this->registerService(LoggerInterface::class, function(ContainerInterface $c) { |
|
136 | 136 | return new ScopedPsrLogger( |
137 | 137 | $c->get(PsrLoggerAdapter::class), |
138 | 138 | $c->get('AppName') |
139 | 139 | ); |
140 | 140 | }); |
141 | - $this->registerService(ILogger::class, function (ContainerInterface $c) { |
|
141 | + $this->registerService(ILogger::class, function(ContainerInterface $c) { |
|
142 | 142 | return new OC\AppFramework\Logger($this->server->query(ILogger::class), $c->get('AppName')); |
143 | 143 | }); |
144 | 144 | |
145 | - $this->registerService(IServerContainer::class, function () { |
|
145 | + $this->registerService(IServerContainer::class, function() { |
|
146 | 146 | return $this->getServer(); |
147 | 147 | }); |
148 | 148 | $this->registerAlias('ServerContainer', IServerContainer::class); |
149 | 149 | |
150 | - $this->registerService(\OCP\WorkflowEngine\IManager::class, function (ContainerInterface $c) { |
|
150 | + $this->registerService(\OCP\WorkflowEngine\IManager::class, function(ContainerInterface $c) { |
|
151 | 151 | return $c->get(Manager::class); |
152 | 152 | }); |
153 | 153 | |
154 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
154 | + $this->registerService(ContainerInterface::class, function(ContainerInterface $c) { |
|
155 | 155 | return $c; |
156 | 156 | }); |
157 | 157 | $this->registerAlias(IAppContainer::class, ContainerInterface::class); |
158 | 158 | |
159 | 159 | // commonly used attributes |
160 | - $this->registerService('UserId', function (ContainerInterface $c) { |
|
160 | + $this->registerService('UserId', function(ContainerInterface $c) { |
|
161 | 161 | return $c->get(IUserSession::class)->getSession()->get('user_id'); |
162 | 162 | }); |
163 | 163 | |
164 | - $this->registerService('WebRoot', function (ContainerInterface $c) { |
|
164 | + $this->registerService('WebRoot', function(ContainerInterface $c) { |
|
165 | 165 | return $c->get(IServerContainer::class)->getWebRoot(); |
166 | 166 | }); |
167 | 167 | |
168 | - $this->registerService('OC_Defaults', function (ContainerInterface $c) { |
|
168 | + $this->registerService('OC_Defaults', function(ContainerInterface $c) { |
|
169 | 169 | return $c->get(IServerContainer::class)->getThemingDefaults(); |
170 | 170 | }); |
171 | 171 | |
172 | - $this->registerService('Protocol', function (ContainerInterface $c) { |
|
172 | + $this->registerService('Protocol', function(ContainerInterface $c) { |
|
173 | 173 | /** @var \OC\Server $server */ |
174 | 174 | $server = $c->get(IServerContainer::class); |
175 | 175 | $protocol = $server->getRequest()->getHttpProtocol(); |
176 | 176 | return new Http($_SERVER, $protocol); |
177 | 177 | }); |
178 | 178 | |
179 | - $this->registerService('Dispatcher', function (ContainerInterface $c) { |
|
179 | + $this->registerService('Dispatcher', function(ContainerInterface $c) { |
|
180 | 180 | return new Dispatcher( |
181 | 181 | $c->get('Protocol'), |
182 | 182 | $c->get(MiddlewareDispatcher::class), |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * Middleware |
197 | 197 | */ |
198 | 198 | $this->registerAlias('MiddlewareDispatcher', MiddlewareDispatcher::class); |
199 | - $this->registerService(MiddlewareDispatcher::class, function (ContainerInterface $c) { |
|
199 | + $this->registerService(MiddlewareDispatcher::class, function(ContainerInterface $c) { |
|
200 | 200 | $server = $this->getServer(); |
201 | 201 | |
202 | 202 | $dispatcher = new MiddlewareDispatcher(); |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | return $dispatcher; |
313 | 313 | }); |
314 | 314 | |
315 | - $this->registerService(IAppConfig::class, function (ContainerInterface $c) { |
|
315 | + $this->registerService(IAppConfig::class, function(ContainerInterface $c) { |
|
316 | 316 | return new OC\AppFramework\Services\AppConfig( |
317 | 317 | $c->get(IConfig::class), |
318 | 318 | $c->get('AppName') |
319 | 319 | ); |
320 | 320 | }); |
321 | - $this->registerService(IInitialState::class, function (ContainerInterface $c) { |
|
321 | + $this->registerService(IInitialState::class, function(ContainerInterface $c) { |
|
322 | 322 | return new OC\AppFramework\Services\InitialState( |
323 | 323 | $c->get(IInitialStateService::class), |
324 | 324 | $c->get('AppName') |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
407 | 407 | */ |
408 | 408 | public function registerCapability($serviceName) { |
409 | - $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { |
|
409 | + $this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) { |
|
410 | 410 | return $this->query($serviceName); |
411 | 411 | }); |
412 | 412 | } |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | return parent::query($name); |
453 | 453 | } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { |
454 | 454 | return parent::query($name); |
455 | - } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { |
|
455 | + } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']).'\\') === 0) { |
|
456 | 456 | return parent::query($name); |
457 | 457 | } |
458 | 458 | |
459 | - throw new QueryException('Could not resolve ' . $name . '!' . |
|
459 | + throw new QueryException('Could not resolve '.$name.'!'. |
|
460 | 460 | ' Class can not be instantiated', 1); |
461 | 461 | } |
462 | 462 | } |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | public function startRegistration(IUser $user, string $serverHost): PublicKeyCredentialCreationOptions { |
85 | 85 | $rpEntity = new PublicKeyCredentialRpEntity( |
86 | 86 | 'Nextcloud', //Name |
87 | - $this->stripPort($serverHost), //ID |
|
87 | + $this->stripPort($serverHost), //ID |
|
88 | 88 | null //Icon |
89 | 89 | ); |
90 | 90 | |
91 | 91 | $userEntity = new PublicKeyCredentialUserEntity( |
92 | - $user->getUID(), //Name |
|
93 | - $user->getUID(), //ID |
|
92 | + $user->getUID(), //Name |
|
93 | + $user->getUID(), //ID |
|
94 | 94 | $user->getDisplayName() //Display name |
95 | 95 | // 'https://foo.example.co/avatar/123e4567-e89b-12d3-a456-426655440000' //Icon |
96 | 96 | ); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | public function startAuthentication(string $uid, string $serverHost): PublicKeyCredentialRequestOptions { |
179 | 179 | // List of registered PublicKeyCredentialDescriptor classes associated to the user |
180 | - $registeredPublicKeyCredentialDescriptors = array_map(function (PublicKeyCredentialEntity $entity) { |
|
180 | + $registeredPublicKeyCredentialDescriptors = array_map(function(PublicKeyCredentialEntity $entity) { |
|
181 | 181 | $credential = $entity->toPublicKeyCredentialSource(); |
182 | 182 | return new PublicKeyCredentialDescriptor( |
183 | 183 | $credential->getType(), |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | |
188 | 188 | // Public Key Credential Request Options |
189 | 189 | return new PublicKeyCredentialRequestOptions( |
190 | - random_bytes(32), // Challenge |
|
191 | - 60000, // Timeout |
|
192 | - $this->stripPort($serverHost), // Relying Party ID |
|
193 | - $registeredPublicKeyCredentialDescriptors, // Registered PublicKeyCredentialDescriptor classes |
|
190 | + random_bytes(32), // Challenge |
|
191 | + 60000, // Timeout |
|
192 | + $this->stripPort($serverHost), // Relying Party ID |
|
193 | + $registeredPublicKeyCredentialDescriptors, // Registered PublicKeyCredentialDescriptor classes |
|
194 | 194 | AuthenticatorSelectionCriteria::USER_VERIFICATION_REQUIREMENT_DISCOURAGED |
195 | 195 | ); |
196 | 196 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | ); |
217 | 217 | |
218 | 218 | try { |
219 | - $this->logger->debug('Loading publickey credentials from: ' . $data); |
|
219 | + $this->logger->debug('Loading publickey credentials from: '.$data); |
|
220 | 220 | |
221 | 221 | // Load the data |
222 | 222 | $publicKeyCredential = $publicKeyCredentialLoader->load($data); |