@@ -133,16 +133,16 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | private static function getInternalFolder(string $name): string { |
| 136 | - return implode('/', str_split(substr(md5($name), 0, 7))) . '/' . $name; |
|
| 136 | + return implode('/', str_split(substr(md5($name), 0, 7))).'/'.$name; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | #[TestDox("Test the migration from the 'new' nested hierarchy to the database format")] |
| 140 | 140 | public function testMigrationPath(): void { |
| 141 | - $folder = $this->previewAppData->newFolder(self::getInternalFolder((string)5)); |
|
| 141 | + $folder = $this->previewAppData->newFolder(self::getInternalFolder((string) 5)); |
|
| 142 | 142 | $folder->newFile('64-64-crop.jpg', 'abcdefg'); |
| 143 | 143 | $folder->newFile('128-128-crop.png', 'abcdefg'); |
| 144 | 144 | |
| 145 | - $folder = $this->previewAppData->getFolder(self::getInternalFolder((string)5)); |
|
| 145 | + $folder = $this->previewAppData->getFolder(self::getInternalFolder((string) 5)); |
|
| 146 | 146 | $this->assertEquals(2, count($folder->getDirectoryListing())); |
| 147 | 147 | $this->assertEquals(0, count(iterator_to_array($this->previewMapper->getAvailablePreviewsForFile(5)))); |
| 148 | 148 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | #[TestDox("Test the migration from the 'new' nested hierarchy to the database format")] |
| 168 | 168 | public function testMigrationPathWithVersion(): void { |
| 169 | - $folder = $this->previewAppData->newFolder(self::getInternalFolder((string)5)); |
|
| 169 | + $folder = $this->previewAppData->newFolder(self::getInternalFolder((string) 5)); |
|
| 170 | 170 | // No version |
| 171 | 171 | $folder->newFile('128-128-crop.png', 'abcdefg'); |
| 172 | 172 | $folder->newFile('256-256-max.png', 'abcdefg'); |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $folder->newFile('1001-256-256-max.png', 'abcdefg'); |
| 183 | 183 | $folder->newFile('1001-128-128.png', 'abcdefg'); |
| 184 | 184 | |
| 185 | - $folder = $this->previewAppData->getFolder(self::getInternalFolder((string)5)); |
|
| 185 | + $folder = $this->previewAppData->getFolder(self::getInternalFolder((string) 5)); |
|
| 186 | 186 | $this->assertEquals(9, count($folder->getDirectoryListing())); |
| 187 | 187 | $this->assertEquals(0, count(iterator_to_array($this->previewMapper->getAvailablePreviewsForFile(5)))); |
| 188 | 188 | |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | ->willReturn([42 => []]); |
| 144 | 144 | |
| 145 | 145 | $this->config->method('getSystemValueString') |
| 146 | - ->willReturnCallback(function ($key, $default) { |
|
| 146 | + ->willReturnCallback(function($key, $default) { |
|
| 147 | 147 | return $default; |
| 148 | 148 | }); |
| 149 | 149 | |
| 150 | 150 | $this->config->method('getSystemValueInt') |
| 151 | - ->willReturnCallback(function ($key, $default) { |
|
| 151 | + ->willReturnCallback(function($key, $default) { |
|
| 152 | 152 | return $default; |
| 153 | 153 | }); |
| 154 | 154 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | ]); |
| 171 | 171 | |
| 172 | 172 | $this->helper->method('getProvider') |
| 173 | - ->willReturnCallback(function ($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { |
|
| 173 | + ->willReturnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) { |
|
| 174 | 174 | if ($provider === 'wrongProvider') { |
| 175 | 175 | $this->fail('Wrongprovider should not be constructed!'); |
| 176 | 176 | } elseif ($provider === 'brokenProvider') { |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $image->method('dataMimeType')->willReturn('image/png'); |
| 193 | 193 | |
| 194 | 194 | $this->helper->method('getThumbnail') |
| 195 | - ->willReturnCallback(function ($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image): false|IImage { |
|
| 195 | + ->willReturnCallback(function($provider, $file, $x, $y) use ($invalidProvider, $validProvider, $image): false | IImage { |
|
| 196 | 196 | if ($provider === $validProvider) { |
| 197 | 197 | return $image; |
| 198 | 198 | } else { |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | ->willReturnCallback(fn (Preview $preview): Preview => $preview); |
| 211 | 211 | |
| 212 | 212 | $this->storageFactory->method('writePreview') |
| 213 | - ->willReturnCallback(function (Preview $preview, mixed $data) use ($hasVersion): int { |
|
| 213 | + ->willReturnCallback(function(Preview $preview, mixed $data) use ($hasVersion): int { |
|
| 214 | 214 | $data = stream_get_contents($data); |
| 215 | 215 | if ($hasVersion) { |
| 216 | 216 | switch ($preview->getName()) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | return 1000; |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | - $this->fail('file name is wrong:' . $preview->getName()); |
|
| 234 | + $this->fail('file name is wrong:'.$preview->getName()); |
|
| 235 | 235 | }); |
| 236 | 236 | |
| 237 | 237 | $image = $this->getMockImage(2048, 2048, 'my resized data'); |
@@ -341,13 +341,13 @@ discard block |
||
| 341 | 341 | $image->method('dataMimeType')->willReturn('image/png'); |
| 342 | 342 | $image->method('data')->willReturn($data); |
| 343 | 343 | |
| 344 | - $image->method('resizeCopy')->willReturnCallback(function ($size) use ($data) { |
|
| 344 | + $image->method('resizeCopy')->willReturnCallback(function($size) use ($data) { |
|
| 345 | 345 | return $this->getMockImage($size, $size, $data); |
| 346 | 346 | }); |
| 347 | - $image->method('preciseResizeCopy')->willReturnCallback(function ($width, $height) use ($data) { |
|
| 347 | + $image->method('preciseResizeCopy')->willReturnCallback(function($width, $height) use ($data) { |
|
| 348 | 348 | return $this->getMockImage($width, $height, $data); |
| 349 | 349 | }); |
| 350 | - $image->method('cropCopy')->willReturnCallback(function ($x, $y, $width, $height) use ($data) { |
|
| 350 | + $image->method('cropCopy')->willReturnCallback(function($x, $y, $width, $height) use ($data) { |
|
| 351 | 351 | return $this->getMockImage($width, $height, $data); |
| 352 | 352 | }); |
| 353 | 353 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $maxPreview->setVersion(null); |
| 407 | 407 | $maxPreview->setMimeType('image/png'); |
| 408 | 408 | |
| 409 | - $this->assertSame($maxPreview->getName(), $maxX . '-' . $maxY . '-max.png'); |
|
| 409 | + $this->assertSame($maxPreview->getName(), $maxX.'-'.$maxY.'-max.png'); |
|
| 410 | 410 | $this->assertSame($maxPreview->getMimeType(), 'image/png'); |
| 411 | 411 | |
| 412 | 412 | $this->previewMapper->method('getAvailablePreviews') |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $maxPreview, |
| 416 | 416 | ]]); |
| 417 | 417 | |
| 418 | - $filename = $expectedX . '-' . $expectedY; |
|
| 418 | + $filename = $expectedX.'-'.$expectedY; |
|
| 419 | 419 | if ($crop) { |
| 420 | 420 | $filename .= '-crop'; |
| 421 | 421 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | ->willReturn($image); |
| 427 | 427 | |
| 428 | 428 | $this->previewMapper->method('insert') |
| 429 | - ->willReturnCallback(function (Preview $preview) use ($filename): Preview { |
|
| 429 | + ->willReturnCallback(function(Preview $preview) use ($filename): Preview { |
|
| 430 | 430 | $this->assertSame($preview->getName(), $filename); |
| 431 | 431 | return $preview; |
| 432 | 432 | }); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $qb = $this->connection->getQueryBuilder(); |
| 56 | 56 | $qb->insert('preview_locations') |
| 57 | 57 | ->values([ |
| 58 | - 'bucket_name' => $qb->createNamedParameter('preview-' . $bucket), |
|
| 58 | + 'bucket_name' => $qb->createNamedParameter('preview-'.$bucket), |
|
| 59 | 59 | 'object_store_name' => $qb->createNamedParameter('default'), |
| 60 | 60 | ]); |
| 61 | 61 | $qb->executeStatement(); |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | $files = []; |
| 88 | 88 | foreach (range(0, 10) as $i) { |
| 89 | - $file = $userFolder->newFile($i . '.txt'); |
|
| 89 | + $file = $userFolder->newFile($i.'.txt'); |
|
| 90 | 90 | $file->putContent('hello world!'); |
| 91 | 91 | $this->previewManager->getPreview($file); |
| 92 | 92 | $files[] = $file; |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $this->registerParameter('isCLI', \OC::$CLI); |
| 265 | 265 | $this->registerParameter('serverRoot', \OC::$SERVERROOT); |
| 266 | 266 | |
| 267 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
| 267 | + $this->registerService(ContainerInterface::class, function(ContainerInterface $c) { |
|
| 268 | 268 | return $c; |
| 269 | 269 | }); |
| 270 | 270 | $this->registerDeprecatedAlias(\OCP\IServerContainer::class, ContainerInterface::class); |
@@ -285,11 +285,11 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
| 287 | 287 | |
| 288 | - $this->registerService(View::class, function (Server $c) { |
|
| 288 | + $this->registerService(View::class, function(Server $c) { |
|
| 289 | 289 | return new View(); |
| 290 | 290 | }, false); |
| 291 | 291 | |
| 292 | - $this->registerService(IPreview::class, function (ContainerInterface $c) { |
|
| 292 | + $this->registerService(IPreview::class, function(ContainerInterface $c) { |
|
| 293 | 293 | return new PreviewManager( |
| 294 | 294 | $c->get(\OCP\IConfig::class), |
| 295 | 295 | $c->get(IRootFolder::class), |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | }); |
| 305 | 305 | $this->registerAlias(IMimeIconProvider::class, MimeIconProvider::class); |
| 306 | 306 | |
| 307 | - $this->registerService(Watcher::class, function (ContainerInterface $c): Watcher { |
|
| 307 | + $this->registerService(Watcher::class, function(ContainerInterface $c): Watcher { |
|
| 308 | 308 | return new Watcher( |
| 309 | 309 | $c->get(\OC\Preview\Storage\StorageFactory::class), |
| 310 | 310 | $c->get(PreviewMapper::class), |
@@ -312,11 +312,11 @@ discard block |
||
| 312 | 312 | ); |
| 313 | 313 | }); |
| 314 | 314 | |
| 315 | - $this->registerService(IProfiler::class, function (Server $c) { |
|
| 315 | + $this->registerService(IProfiler::class, function(Server $c) { |
|
| 316 | 316 | return new Profiler($c->get(SystemConfig::class)); |
| 317 | 317 | }); |
| 318 | 318 | |
| 319 | - $this->registerService(Encryption\Manager::class, function (Server $c): Encryption\Manager { |
|
| 319 | + $this->registerService(Encryption\Manager::class, function(Server $c): Encryption\Manager { |
|
| 320 | 320 | $view = new View(); |
| 321 | 321 | $util = new Encryption\Util( |
| 322 | 322 | $view, |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | }); |
| 336 | 336 | $this->registerAlias(\OCP\Encryption\IManager::class, Encryption\Manager::class); |
| 337 | 337 | |
| 338 | - $this->registerService(IFile::class, function (ContainerInterface $c) { |
|
| 338 | + $this->registerService(IFile::class, function(ContainerInterface $c) { |
|
| 339 | 339 | $util = new Encryption\Util( |
| 340 | 340 | new View(), |
| 341 | 341 | $c->get(IUserManager::class), |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | ); |
| 350 | 350 | }); |
| 351 | 351 | |
| 352 | - $this->registerService(IStorage::class, function (ContainerInterface $c) { |
|
| 352 | + $this->registerService(IStorage::class, function(ContainerInterface $c) { |
|
| 353 | 353 | $view = new View(); |
| 354 | 354 | $util = new Encryption\Util( |
| 355 | 355 | $view, |
@@ -368,23 +368,23 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | $this->registerAlias(\OCP\ITagManager::class, TagManager::class); |
| 370 | 370 | |
| 371 | - $this->registerService('SystemTagManagerFactory', function (ContainerInterface $c) { |
|
| 371 | + $this->registerService('SystemTagManagerFactory', function(ContainerInterface $c) { |
|
| 372 | 372 | /** @var \OCP\IConfig $config */ |
| 373 | 373 | $config = $c->get(\OCP\IConfig::class); |
| 374 | 374 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
| 375 | 375 | return new $factoryClass($this); |
| 376 | 376 | }); |
| 377 | - $this->registerService(ISystemTagManager::class, function (ContainerInterface $c) { |
|
| 377 | + $this->registerService(ISystemTagManager::class, function(ContainerInterface $c) { |
|
| 378 | 378 | return $c->get('SystemTagManagerFactory')->getManager(); |
| 379 | 379 | }); |
| 380 | 380 | /** @deprecated 19.0.0 */ |
| 381 | 381 | $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
| 382 | 382 | |
| 383 | - $this->registerService(ISystemTagObjectMapper::class, function (ContainerInterface $c) { |
|
| 383 | + $this->registerService(ISystemTagObjectMapper::class, function(ContainerInterface $c) { |
|
| 384 | 384 | return $c->get('SystemTagManagerFactory')->getObjectMapper(); |
| 385 | 385 | }); |
| 386 | 386 | $this->registerAlias(IFileAccess::class, FileAccess::class); |
| 387 | - $this->registerService('RootFolder', function (ContainerInterface $c) { |
|
| 387 | + $this->registerService('RootFolder', function(ContainerInterface $c) { |
|
| 388 | 388 | $manager = \OC\Files\Filesystem::getMountManager(); |
| 389 | 389 | $view = new View(); |
| 390 | 390 | /** @var IUserSession $userSession */ |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | |
| 411 | 411 | return $root; |
| 412 | 412 | }); |
| 413 | - $this->registerService(HookConnector::class, function (ContainerInterface $c) { |
|
| 413 | + $this->registerService(HookConnector::class, function(ContainerInterface $c) { |
|
| 414 | 414 | return new HookConnector( |
| 415 | 415 | $c->get(IRootFolder::class), |
| 416 | 416 | new View(), |
@@ -419,19 +419,19 @@ discard block |
||
| 419 | 419 | ); |
| 420 | 420 | }); |
| 421 | 421 | |
| 422 | - $this->registerService(IRootFolder::class, function (ContainerInterface $c) { |
|
| 423 | - return new LazyRoot(function () use ($c) { |
|
| 422 | + $this->registerService(IRootFolder::class, function(ContainerInterface $c) { |
|
| 423 | + return new LazyRoot(function() use ($c) { |
|
| 424 | 424 | return $c->get('RootFolder'); |
| 425 | 425 | }); |
| 426 | 426 | }); |
| 427 | 427 | |
| 428 | 428 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
| 429 | 429 | |
| 430 | - $this->registerService(DisplayNameCache::class, function (ContainerInterface $c) { |
|
| 430 | + $this->registerService(DisplayNameCache::class, function(ContainerInterface $c) { |
|
| 431 | 431 | return $c->get(\OC\User\Manager::class)->getDisplayNameCache(); |
| 432 | 432 | }); |
| 433 | 433 | |
| 434 | - $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { |
|
| 434 | + $this->registerService(\OCP\IGroupManager::class, function(ContainerInterface $c) { |
|
| 435 | 435 | $groupManager = new \OC\Group\Manager( |
| 436 | 436 | $this->get(IUserManager::class), |
| 437 | 437 | $this->get(IEventDispatcher::class), |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | return $groupManager; |
| 443 | 443 | }); |
| 444 | 444 | |
| 445 | - $this->registerService(Store::class, function (ContainerInterface $c) { |
|
| 445 | + $this->registerService(Store::class, function(ContainerInterface $c) { |
|
| 446 | 446 | $session = $c->get(ISession::class); |
| 447 | 447 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
| 448 | 448 | $tokenProvider = $c->get(IProvider::class); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
| 458 | 458 | $this->registerAlias(OCPIProvider::class, Authentication\Token\Manager::class); |
| 459 | 459 | |
| 460 | - $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
| 460 | + $this->registerService(\OC\User\Session::class, function(Server $c) { |
|
| 461 | 461 | $manager = $c->get(IUserManager::class); |
| 462 | 462 | $session = new \OC\Session\Memory(); |
| 463 | 463 | $timeFactory = new TimeFactory(); |
@@ -481,40 +481,40 @@ discard block |
||
| 481 | 481 | $c->get(IEventDispatcher::class), |
| 482 | 482 | ); |
| 483 | 483 | /** @deprecated 21.0.0 use BeforeUserCreatedEvent event with the IEventDispatcher instead */ |
| 484 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 484 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
| 485 | 485 | \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
| 486 | 486 | }); |
| 487 | 487 | /** @deprecated 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */ |
| 488 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 488 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
| 489 | 489 | /** @var \OC\User\User $user */ |
| 490 | 490 | \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
| 491 | 491 | }); |
| 492 | 492 | /** @deprecated 21.0.0 use BeforeUserDeletedEvent event with the IEventDispatcher instead */ |
| 493 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
| 493 | + $userSession->listen('\OC\User', 'preDelete', function($user) { |
|
| 494 | 494 | /** @var \OC\User\User $user */ |
| 495 | 495 | \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
| 496 | 496 | }); |
| 497 | 497 | /** @deprecated 21.0.0 use UserDeletedEvent event with the IEventDispatcher instead */ |
| 498 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 498 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
| 499 | 499 | /** @var \OC\User\User $user */ |
| 500 | 500 | \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
| 501 | 501 | }); |
| 502 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 502 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
| 503 | 503 | /** @var \OC\User\User $user */ |
| 504 | 504 | \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
| 505 | 505 | }); |
| 506 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 506 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
| 507 | 507 | /** @var \OC\User\User $user */ |
| 508 | 508 | \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
| 509 | 509 | }); |
| 510 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 510 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
| 511 | 511 | \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
| 512 | 512 | |
| 513 | 513 | /** @var IEventDispatcher $dispatcher */ |
| 514 | 514 | $dispatcher = $this->get(IEventDispatcher::class); |
| 515 | 515 | $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
| 516 | 516 | }); |
| 517 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $loginName, $password, $isTokenLogin) { |
|
| 517 | + $userSession->listen('\OC\User', 'postLogin', function($user, $loginName, $password, $isTokenLogin) { |
|
| 518 | 518 | /** @var \OC\User\User $user */ |
| 519 | 519 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'loginName' => $loginName, 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
| 520 | 520 | |
@@ -522,12 +522,12 @@ discard block |
||
| 522 | 522 | $dispatcher = $this->get(IEventDispatcher::class); |
| 523 | 523 | $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $loginName, $password, $isTokenLogin)); |
| 524 | 524 | }); |
| 525 | - $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
| 525 | + $userSession->listen('\OC\User', 'preRememberedLogin', function($uid) { |
|
| 526 | 526 | /** @var IEventDispatcher $dispatcher */ |
| 527 | 527 | $dispatcher = $this->get(IEventDispatcher::class); |
| 528 | 528 | $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
| 529 | 529 | }); |
| 530 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 530 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
| 531 | 531 | /** @var \OC\User\User $user */ |
| 532 | 532 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
| 533 | 533 | |
@@ -535,19 +535,19 @@ discard block |
||
| 535 | 535 | $dispatcher = $this->get(IEventDispatcher::class); |
| 536 | 536 | $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
| 537 | 537 | }); |
| 538 | - $userSession->listen('\OC\User', 'logout', function ($user) { |
|
| 538 | + $userSession->listen('\OC\User', 'logout', function($user) { |
|
| 539 | 539 | \OC_Hook::emit('OC_User', 'logout', []); |
| 540 | 540 | |
| 541 | 541 | /** @var IEventDispatcher $dispatcher */ |
| 542 | 542 | $dispatcher = $this->get(IEventDispatcher::class); |
| 543 | 543 | $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
| 544 | 544 | }); |
| 545 | - $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
| 545 | + $userSession->listen('\OC\User', 'postLogout', function($user) { |
|
| 546 | 546 | /** @var IEventDispatcher $dispatcher */ |
| 547 | 547 | $dispatcher = $this->get(IEventDispatcher::class); |
| 548 | 548 | $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
| 549 | 549 | }); |
| 550 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
| 550 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
| 551 | 551 | /** @var \OC\User\User $user */ |
| 552 | 552 | \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
| 553 | 553 | }); |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
| 563 | 563 | |
| 564 | - $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
| 564 | + $this->registerService(\OC\SystemConfig::class, function($c) use ($config) { |
|
| 565 | 565 | return new \OC\SystemConfig($config); |
| 566 | 566 | }); |
| 567 | 567 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | $this->registerAlias(IUserConfig::class, \OC\Config\UserConfig::class); |
| 570 | 570 | $this->registerAlias(IAppManager::class, AppManager::class); |
| 571 | 571 | |
| 572 | - $this->registerService(IFactory::class, function (Server $c) { |
|
| 572 | + $this->registerService(IFactory::class, function(Server $c) { |
|
| 573 | 573 | return new \OC\L10N\Factory( |
| 574 | 574 | $c->get(\OCP\IConfig::class), |
| 575 | 575 | $c->getRequest(), |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $this->registerAlias(IURLGenerator::class, URLGenerator::class); |
| 584 | 584 | |
| 585 | 585 | $this->registerAlias(ICache::class, Cache\File::class); |
| 586 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 586 | + $this->registerService(Factory::class, function(Server $c) { |
|
| 587 | 587 | $profiler = $c->get(IProfiler::class); |
| 588 | 588 | $logger = $c->get(LoggerInterface::class); |
| 589 | 589 | $serverVersion = $c->get(ServerVersion::class); |
@@ -616,12 +616,12 @@ discard block |
||
| 616 | 616 | }); |
| 617 | 617 | $this->registerAlias(ICacheFactory::class, Factory::class); |
| 618 | 618 | |
| 619 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 619 | + $this->registerService('RedisFactory', function(Server $c) { |
|
| 620 | 620 | $systemConfig = $c->get(SystemConfig::class); |
| 621 | 621 | return new RedisFactory($systemConfig, $c->get(IEventLogger::class)); |
| 622 | 622 | }); |
| 623 | 623 | |
| 624 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 624 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
| 625 | 625 | $l10n = $this->get(IFactory::class)->get('lib'); |
| 626 | 626 | return new \OC\Activity\Manager( |
| 627 | 627 | $c->getRequest(), |
@@ -634,14 +634,14 @@ discard block |
||
| 634 | 634 | ); |
| 635 | 635 | }); |
| 636 | 636 | |
| 637 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 637 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
| 638 | 638 | return new \OC\Activity\EventMerger( |
| 639 | 639 | $c->getL10N('lib') |
| 640 | 640 | ); |
| 641 | 641 | }); |
| 642 | 642 | $this->registerAlias(IValidator::class, Validator::class); |
| 643 | 643 | |
| 644 | - $this->registerService(AvatarManager::class, function (Server $c) { |
|
| 644 | + $this->registerService(AvatarManager::class, function(Server $c) { |
|
| 645 | 645 | return new AvatarManager( |
| 646 | 646 | $c->get(IUserSession::class), |
| 647 | 647 | $c->get(\OC\User\Manager::class), |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | $this->registerAlias(\OCP\Support\Subscription\IAssertion::class, \OC\Support\Subscription\Assertion::class); |
| 662 | 662 | |
| 663 | 663 | /** Only used by the PsrLoggerAdapter should not be used by apps */ |
| 664 | - $this->registerService(\OC\Log::class, function (Server $c) { |
|
| 664 | + $this->registerService(\OC\Log::class, function(Server $c) { |
|
| 665 | 665 | $logType = $c->get(AllConfig::class)->getSystemValue('log_type', 'file'); |
| 666 | 666 | $factory = new LogFactory($c, $this->get(SystemConfig::class)); |
| 667 | 667 | $logger = $factory->get($logType); |
@@ -672,13 +672,13 @@ discard block |
||
| 672 | 672 | // PSR-3 logger |
| 673 | 673 | $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
| 674 | 674 | |
| 675 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
| 675 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
| 676 | 676 | return new LogFactory($c, $this->get(SystemConfig::class)); |
| 677 | 677 | }); |
| 678 | 678 | |
| 679 | 679 | $this->registerAlias(IJobList::class, \OC\BackgroundJob\JobList::class); |
| 680 | 680 | |
| 681 | - $this->registerService(Router::class, function (Server $c) { |
|
| 681 | + $this->registerService(Router::class, function(Server $c) { |
|
| 682 | 682 | $cacheFactory = $c->get(ICacheFactory::class); |
| 683 | 683 | if ($cacheFactory->isLocalCacheAvailable()) { |
| 684 | 684 | $router = $c->resolve(CachingRouter::class); |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | }); |
| 690 | 690 | $this->registerAlias(IRouter::class, Router::class); |
| 691 | 691 | |
| 692 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 692 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
| 693 | 693 | $config = $c->get(\OCP\IConfig::class); |
| 694 | 694 | if (ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === \OC\Memcache\Redis::class) { |
| 695 | 695 | $backend = new \OC\Security\RateLimiting\Backend\MemoryCacheBackend( |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | $this->registerAlias(ICredentialsManager::class, CredentialsManager::class); |
| 720 | 720 | |
| 721 | 721 | $this->registerAlias(IDBConnection::class, ConnectionAdapter::class); |
| 722 | - $this->registerService(Connection::class, function (Server $c) { |
|
| 722 | + $this->registerService(Connection::class, function(Server $c) { |
|
| 723 | 723 | $systemConfig = $c->get(SystemConfig::class); |
| 724 | 724 | $factory = new \OC\DB\ConnectionFactory($systemConfig, $c->get(ICacheFactory::class)); |
| 725 | 725 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -732,17 +732,17 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | $this->registerAlias(ICertificateManager::class, CertificateManager::class); |
| 734 | 734 | $this->registerAlias(IClientService::class, ClientService::class); |
| 735 | - $this->registerService(NegativeDnsCache::class, function (ContainerInterface $c) { |
|
| 735 | + $this->registerService(NegativeDnsCache::class, function(ContainerInterface $c) { |
|
| 736 | 736 | return new NegativeDnsCache( |
| 737 | 737 | $c->get(ICacheFactory::class), |
| 738 | 738 | ); |
| 739 | 739 | }); |
| 740 | 740 | $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
| 741 | - $this->registerService(IEventLogger::class, function (ContainerInterface $c) { |
|
| 741 | + $this->registerService(IEventLogger::class, function(ContainerInterface $c) { |
|
| 742 | 742 | return new EventLogger($c->get(SystemConfig::class), $c->get(LoggerInterface::class), $c->get(Log::class)); |
| 743 | 743 | }); |
| 744 | 744 | |
| 745 | - $this->registerService(IQueryLogger::class, function (ContainerInterface $c) { |
|
| 745 | + $this->registerService(IQueryLogger::class, function(ContainerInterface $c) { |
|
| 746 | 746 | $queryLogger = new QueryLogger(); |
| 747 | 747 | if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
| 748 | 748 | // In debug mode, module is being activated by default |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | $this->registerAlias(ITempManager::class, TempManager::class); |
| 755 | 755 | $this->registerAlias(IDateTimeZone::class, DateTimeZone::class); |
| 756 | 756 | |
| 757 | - $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
| 757 | + $this->registerService(IDateTimeFormatter::class, function(Server $c) { |
|
| 758 | 758 | $language = $c->get(\OCP\IConfig::class)->getUserValue($c->get(ISession::class)->get('user_id'), 'core', 'lang', null); |
| 759 | 759 | |
| 760 | 760 | return new DateTimeFormatter( |
@@ -763,14 +763,14 @@ discard block |
||
| 763 | 763 | ); |
| 764 | 764 | }); |
| 765 | 765 | |
| 766 | - $this->registerService(IUserMountCache::class, function (ContainerInterface $c) { |
|
| 766 | + $this->registerService(IUserMountCache::class, function(ContainerInterface $c) { |
|
| 767 | 767 | $mountCache = $c->get(UserMountCache::class); |
| 768 | 768 | $listener = new UserMountCacheListener($mountCache); |
| 769 | 769 | $listener->listen($c->get(IUserManager::class)); |
| 770 | 770 | return $mountCache; |
| 771 | 771 | }); |
| 772 | 772 | |
| 773 | - $this->registerService(IMountProviderCollection::class, function (ContainerInterface $c) { |
|
| 773 | + $this->registerService(IMountProviderCollection::class, function(ContainerInterface $c) { |
|
| 774 | 774 | $loader = $c->get(IStorageFactory::class); |
| 775 | 775 | $mountCache = $c->get(IUserMountCache::class); |
| 776 | 776 | $eventLogger = $c->get(IEventLogger::class); |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | return $manager; |
| 790 | 790 | }); |
| 791 | 791 | |
| 792 | - $this->registerService(IBus::class, function (ContainerInterface $c) { |
|
| 792 | + $this->registerService(IBus::class, function(ContainerInterface $c) { |
|
| 793 | 793 | $busClass = $c->get(\OCP\IConfig::class)->getSystemValueString('commandbus'); |
| 794 | 794 | if ($busClass) { |
| 795 | 795 | [$app, $class] = explode('::', $busClass, 2); |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | $this->registerAlias(ITrustedDomainHelper::class, TrustedDomainHelper::class); |
| 809 | 809 | $this->registerAlias(IThrottler::class, Throttler::class); |
| 810 | 810 | |
| 811 | - $this->registerService(\OC\Security\Bruteforce\Backend\IBackend::class, function ($c) { |
|
| 811 | + $this->registerService(\OC\Security\Bruteforce\Backend\IBackend::class, function($c) { |
|
| 812 | 812 | $config = $c->get(\OCP\IConfig::class); |
| 813 | 813 | if (!$config->getSystemValueBool('auth.bruteforce.protection.force.database', false) |
| 814 | 814 | && ltrim($config->getSystemValueString('memcache.distributed', ''), '\\') === \OC\Memcache\Redis::class) { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | }); |
| 822 | 822 | |
| 823 | 823 | $this->registerDeprecatedAlias('IntegrityCodeChecker', Checker::class); |
| 824 | - $this->registerService(Checker::class, function (ContainerInterface $c) { |
|
| 824 | + $this->registerService(Checker::class, function(ContainerInterface $c) { |
|
| 825 | 825 | // IConfig requires a working database. This code |
| 826 | 826 | // might however be called when Nextcloud is not yet setup. |
| 827 | 827 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | $c->get(IMimeTypeDetector::class) |
| 844 | 844 | ); |
| 845 | 845 | }); |
| 846 | - $this->registerService(Request::class, function (ContainerInterface $c) { |
|
| 846 | + $this->registerService(Request::class, function(ContainerInterface $c) { |
|
| 847 | 847 | if (isset($this['urlParams'])) { |
| 848 | 848 | $urlParams = $this['urlParams']; |
| 849 | 849 | } else { |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | }); |
| 880 | 880 | $this->registerAlias(\OCP\IRequest::class, Request::class); |
| 881 | 881 | |
| 882 | - $this->registerService(IRequestId::class, function (ContainerInterface $c): IRequestId { |
|
| 882 | + $this->registerService(IRequestId::class, function(ContainerInterface $c): IRequestId { |
|
| 883 | 883 | return new RequestId( |
| 884 | 884 | $_SERVER['UNIQUE_ID'] ?? '', |
| 885 | 885 | $this->get(ISecureRandom::class) |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | /** @since 32.0.0 */ |
| 890 | 890 | $this->registerAlias(IEmailValidator::class, EmailValidator::class); |
| 891 | 891 | |
| 892 | - $this->registerService(IMailer::class, function (Server $c) { |
|
| 892 | + $this->registerService(IMailer::class, function(Server $c) { |
|
| 893 | 893 | return new Mailer( |
| 894 | 894 | $c->get(\OCP\IConfig::class), |
| 895 | 895 | $c->get(LoggerInterface::class), |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | /** @since 30.0.0 */ |
| 906 | 906 | $this->registerAlias(\OCP\Mail\Provider\IManager::class, \OC\Mail\Provider\Manager::class); |
| 907 | 907 | |
| 908 | - $this->registerService(ILDAPProviderFactory::class, function (ContainerInterface $c) { |
|
| 908 | + $this->registerService(ILDAPProviderFactory::class, function(ContainerInterface $c) { |
|
| 909 | 909 | $config = $c->get(\OCP\IConfig::class); |
| 910 | 910 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
| 911 | 911 | if (is_null($factoryClass) || !class_exists($factoryClass)) { |
@@ -914,11 +914,11 @@ discard block |
||
| 914 | 914 | /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
| 915 | 915 | return new $factoryClass($this); |
| 916 | 916 | }); |
| 917 | - $this->registerService(ILDAPProvider::class, function (ContainerInterface $c) { |
|
| 917 | + $this->registerService(ILDAPProvider::class, function(ContainerInterface $c) { |
|
| 918 | 918 | $factory = $c->get(ILDAPProviderFactory::class); |
| 919 | 919 | return $factory->getLDAPProvider(); |
| 920 | 920 | }); |
| 921 | - $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
|
| 921 | + $this->registerService(ILockingProvider::class, function(ContainerInterface $c) { |
|
| 922 | 922 | $ini = $c->get(IniGetWrapper::class); |
| 923 | 923 | $config = $c->get(\OCP\IConfig::class); |
| 924 | 924 | $ttl = $config->getSystemValueInt('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -940,51 +940,51 @@ discard block |
||
| 940 | 940 | return new NoopLockingProvider(); |
| 941 | 941 | }); |
| 942 | 942 | |
| 943 | - $this->registerService(ILockManager::class, function (Server $c): LockManager { |
|
| 943 | + $this->registerService(ILockManager::class, function(Server $c): LockManager { |
|
| 944 | 944 | return new LockManager(); |
| 945 | 945 | }); |
| 946 | 946 | |
| 947 | 947 | $this->registerAlias(ILockdownManager::class, 'LockdownManager'); |
| 948 | - $this->registerService(SetupManager::class, function ($c) { |
|
| 948 | + $this->registerService(SetupManager::class, function($c) { |
|
| 949 | 949 | // create the setupmanager through the mount manager to resolve the cyclic dependency |
| 950 | 950 | return $c->get(\OC\Files\Mount\Manager::class)->getSetupManager(); |
| 951 | 951 | }); |
| 952 | 952 | $this->registerAlias(IMountManager::class, \OC\Files\Mount\Manager::class); |
| 953 | 953 | |
| 954 | - $this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) { |
|
| 954 | + $this->registerService(IMimeTypeDetector::class, function(ContainerInterface $c) { |
|
| 955 | 955 | return new \OC\Files\Type\Detection( |
| 956 | 956 | $c->get(IURLGenerator::class), |
| 957 | 957 | $c->get(LoggerInterface::class), |
| 958 | 958 | \OC::$configDir, |
| 959 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 959 | + \OC::$SERVERROOT.'/resources/config/' |
|
| 960 | 960 | ); |
| 961 | 961 | }); |
| 962 | 962 | |
| 963 | 963 | $this->registerAlias(IMimeTypeLoader::class, Loader::class); |
| 964 | - $this->registerService(BundleFetcher::class, function () { |
|
| 964 | + $this->registerService(BundleFetcher::class, function() { |
|
| 965 | 965 | return new BundleFetcher($this->getL10N('lib')); |
| 966 | 966 | }); |
| 967 | 967 | $this->registerAlias(\OCP\Notification\IManager::class, Manager::class); |
| 968 | 968 | |
| 969 | - $this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) { |
|
| 969 | + $this->registerService(CapabilitiesManager::class, function(ContainerInterface $c) { |
|
| 970 | 970 | $manager = new CapabilitiesManager($c->get(LoggerInterface::class)); |
| 971 | - $manager->registerCapability(function () use ($c) { |
|
| 971 | + $manager->registerCapability(function() use ($c) { |
|
| 972 | 972 | return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class)); |
| 973 | 973 | }); |
| 974 | - $manager->registerCapability(function () use ($c) { |
|
| 974 | + $manager->registerCapability(function() use ($c) { |
|
| 975 | 975 | return $c->get(\OC\Security\Bruteforce\Capabilities::class); |
| 976 | 976 | }); |
| 977 | 977 | return $manager; |
| 978 | 978 | }); |
| 979 | 979 | |
| 980 | - $this->registerService(ICommentsManager::class, function (Server $c) { |
|
| 980 | + $this->registerService(ICommentsManager::class, function(Server $c) { |
|
| 981 | 981 | $config = $c->get(\OCP\IConfig::class); |
| 982 | 982 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
| 983 | 983 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
| 984 | 984 | $factory = new $factoryClass($this); |
| 985 | 985 | $manager = $factory->getManager(); |
| 986 | 986 | |
| 987 | - $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
| 987 | + $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
|
| 988 | 988 | $manager = $c->get(IUserManager::class); |
| 989 | 989 | $userDisplayName = $manager->getDisplayName($id); |
| 990 | 990 | if ($userDisplayName === null) { |
@@ -998,7 +998,7 @@ discard block |
||
| 998 | 998 | }); |
| 999 | 999 | |
| 1000 | 1000 | $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); |
| 1001 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 1001 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
| 1002 | 1002 | try { |
| 1003 | 1003 | $classExists = class_exists('OCA\Theming\ThemingDefaults'); |
| 1004 | 1004 | } catch (\OCP\AutoloadNotAllowedException $e) { |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | } |
| 1040 | 1040 | return new \OC_Defaults(); |
| 1041 | 1041 | }); |
| 1042 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
| 1042 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
| 1043 | 1043 | return new JSCombiner( |
| 1044 | 1044 | $c->getAppDataDir('js'), |
| 1045 | 1045 | $c->get(IURLGenerator::class), |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | }); |
| 1051 | 1051 | $this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class); |
| 1052 | 1052 | |
| 1053 | - $this->registerService('CryptoWrapper', function (ContainerInterface $c) { |
|
| 1053 | + $this->registerService('CryptoWrapper', function(ContainerInterface $c) { |
|
| 1054 | 1054 | // FIXME: Instantiated here due to cyclic dependency |
| 1055 | 1055 | $request = new Request( |
| 1056 | 1056 | [ |
@@ -1074,12 +1074,12 @@ discard block |
||
| 1074 | 1074 | $request |
| 1075 | 1075 | ); |
| 1076 | 1076 | }); |
| 1077 | - $this->registerService(SessionStorage::class, function (ContainerInterface $c) { |
|
| 1077 | + $this->registerService(SessionStorage::class, function(ContainerInterface $c) { |
|
| 1078 | 1078 | return new SessionStorage($c->get(ISession::class)); |
| 1079 | 1079 | }); |
| 1080 | 1080 | $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
| 1081 | 1081 | |
| 1082 | - $this->registerService(IProviderFactory::class, function (ContainerInterface $c) { |
|
| 1082 | + $this->registerService(IProviderFactory::class, function(ContainerInterface $c) { |
|
| 1083 | 1083 | $config = $c->get(\OCP\IConfig::class); |
| 1084 | 1084 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
| 1085 | 1085 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | |
| 1089 | 1089 | $this->registerAlias(\OCP\Share\IManager::class, \OC\Share20\Manager::class); |
| 1090 | 1090 | |
| 1091 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
| 1091 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
| 1092 | 1092 | $instance = new Collaboration\Collaborators\Search($c); |
| 1093 | 1093 | |
| 1094 | 1094 | // register default plugins |
@@ -1112,20 +1112,20 @@ discard block |
||
| 1112 | 1112 | |
| 1113 | 1113 | $this->registerDeprecatedAlias('SettingsManager', \OC\Settings\Manager::class); |
| 1114 | 1114 | $this->registerAlias(\OCP\Settings\IManager::class, \OC\Settings\Manager::class); |
| 1115 | - $this->registerService(\OC\Files\AppData\Factory::class, function (ContainerInterface $c) { |
|
| 1115 | + $this->registerService(\OC\Files\AppData\Factory::class, function(ContainerInterface $c) { |
|
| 1116 | 1116 | return new \OC\Files\AppData\Factory( |
| 1117 | 1117 | $c->get(IRootFolder::class), |
| 1118 | 1118 | $c->get(SystemConfig::class) |
| 1119 | 1119 | ); |
| 1120 | 1120 | }); |
| 1121 | 1121 | |
| 1122 | - $this->registerService('LockdownManager', function (ContainerInterface $c) { |
|
| 1123 | - return new LockdownManager(function () use ($c) { |
|
| 1122 | + $this->registerService('LockdownManager', function(ContainerInterface $c) { |
|
| 1123 | + return new LockdownManager(function() use ($c) { |
|
| 1124 | 1124 | return $c->get(ISession::class); |
| 1125 | 1125 | }); |
| 1126 | 1126 | }); |
| 1127 | 1127 | |
| 1128 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c) { |
|
| 1128 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(ContainerInterface $c) { |
|
| 1129 | 1129 | return new DiscoveryService( |
| 1130 | 1130 | $c->get(ICacheFactory::class), |
| 1131 | 1131 | $c->get(IClientService::class) |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | }); |
| 1134 | 1134 | $this->registerAlias(IOCMDiscoveryService::class, OCMDiscoveryService::class); |
| 1135 | 1135 | |
| 1136 | - $this->registerService(ICloudIdManager::class, function (ContainerInterface $c) { |
|
| 1136 | + $this->registerService(ICloudIdManager::class, function(ContainerInterface $c) { |
|
| 1137 | 1137 | return new CloudIdManager( |
| 1138 | 1138 | $c->get(ICacheFactory::class), |
| 1139 | 1139 | $c->get(IEventDispatcher::class), |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | $this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
| 1147 | 1147 | $this->registerAlias(ICloudFederationProviderManager::class, CloudFederationProviderManager::class); |
| 1148 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
| 1148 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
| 1149 | 1149 | return new CloudFederationFactory(); |
| 1150 | 1150 | }); |
| 1151 | 1151 | |
@@ -1154,27 +1154,27 @@ discard block |
||
| 1154 | 1154 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
| 1155 | 1155 | $this->registerAlias(\Psr\Clock\ClockInterface::class, \OCP\AppFramework\Utility\ITimeFactory::class); |
| 1156 | 1156 | |
| 1157 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1157 | + $this->registerService(Defaults::class, function(Server $c) { |
|
| 1158 | 1158 | return new Defaults( |
| 1159 | 1159 | $c->get('ThemingDefaults') |
| 1160 | 1160 | ); |
| 1161 | 1161 | }); |
| 1162 | 1162 | |
| 1163 | - $this->registerService(\OCP\ISession::class, function (ContainerInterface $c) { |
|
| 1163 | + $this->registerService(\OCP\ISession::class, function(ContainerInterface $c) { |
|
| 1164 | 1164 | return $c->get(\OCP\IUserSession::class)->getSession(); |
| 1165 | 1165 | }, false); |
| 1166 | 1166 | |
| 1167 | - $this->registerService(IShareHelper::class, function (ContainerInterface $c) { |
|
| 1167 | + $this->registerService(IShareHelper::class, function(ContainerInterface $c) { |
|
| 1168 | 1168 | return new ShareHelper( |
| 1169 | 1169 | $c->get(\OCP\Share\IManager::class) |
| 1170 | 1170 | ); |
| 1171 | 1171 | }); |
| 1172 | 1172 | |
| 1173 | - $this->registerService(IApiFactory::class, function (ContainerInterface $c) { |
|
| 1173 | + $this->registerService(IApiFactory::class, function(ContainerInterface $c) { |
|
| 1174 | 1174 | return new ApiFactory($c->get(IClientService::class)); |
| 1175 | 1175 | }); |
| 1176 | 1176 | |
| 1177 | - $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) { |
|
| 1177 | + $this->registerService(IInstanceFactory::class, function(ContainerInterface $c) { |
|
| 1178 | 1178 | $memcacheFactory = $c->get(ICacheFactory::class); |
| 1179 | 1179 | return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class)); |
| 1180 | 1180 | }); |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | protected function mapRowToEntity(array $row): Entity { |
| 37 | - $row['mimetype'] = $this->mimeTypeLoader->getMimetypeById((int)$row['mimetype_id']); |
|
| 38 | - $row['source_mimetype'] = $this->mimeTypeLoader->getMimetypeById((int)$row['source_mimetype_id']); |
|
| 37 | + $row['mimetype'] = $this->mimeTypeLoader->getMimetypeById((int) $row['mimetype_id']); |
|
| 38 | + $row['source_mimetype'] = $this->mimeTypeLoader->getMimetypeById((int) $row['source_mimetype_id']); |
|
| 39 | 39 | |
| 40 | 40 | return parent::mapRowToEntity($row); |
| 41 | 41 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $qb = $this->db->getQueryBuilder(); |
| 194 | 194 | $this->joinLocation($qb) |
| 195 | 195 | ->where($qb->expr()->orX( |
| 196 | - ...array_map(function (string $mimeType) use ($qb): string { |
|
| 196 | + ...array_map(function(string $mimeType) use ($qb): string { |
|
| 197 | 197 | return $qb->expr()->eq('source_mimetype_id', $qb->createNamedParameter($this->mimeTypeLoader->getId($mimeType), IQueryBuilder::PARAM_INT)); |
| 198 | 198 | }, $mimeTypes) |
| 199 | 199 | )); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | $this->addType('versionId', Types::STRING); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public static function fromPath(string $path, IMimeTypeDetector $mimeTypeDetector): Preview|false { |
|
| 96 | + public static function fromPath(string $path, IMimeTypeDetector $mimeTypeDetector): Preview | false { |
|
| 97 | 97 | $preview = new self(); |
| 98 | - $preview->setFileId((int)basename(dirname($path))); |
|
| 98 | + $preview->setFileId((int) basename(dirname($path))); |
|
| 99 | 99 | |
| 100 | - $fileName = pathinfo($path, PATHINFO_FILENAME) . '.' . pathinfo($path, PATHINFO_EXTENSION); |
|
| 100 | + $fileName = pathinfo($path, PATHINFO_FILENAME).'.'.pathinfo($path, PATHINFO_EXTENSION); |
|
| 101 | 101 | $ok = preg_match('/(([A-Za-z0-9\+\/]+)-)?([0-9]+)-([0-9]+)(-(max))?(-(crop))?\.([a-z]{3,4})/', $fileName, $matches); |
| 102 | 102 | |
| 103 | 103 | if ($ok !== 1) { |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $preview->setMimeType($mimeTypeDetector->detectPath($fileName)); |
| 116 | 116 | |
| 117 | - $preview->setWidth((int)$width); |
|
| 118 | - $preview->setHeight((int)$height); |
|
| 117 | + $preview->setWidth((int) $width); |
|
| 118 | + $preview->setHeight((int) $height); |
|
| 119 | 119 | $preview->setCropped($crop === 'crop'); |
| 120 | 120 | $preview->setMax($max === 'max'); |
| 121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function getName(): string { |
| 129 | - $path = ($this->getVersion() > -1 ? $this->getVersion() . '-' : '') . $this->getWidth() . '-' . $this->getHeight(); |
|
| 129 | + $path = ($this->getVersion() > -1 ? $this->getVersion().'-' : '').$this->getWidth().'-'.$this->getHeight(); |
|
| 130 | 130 | if ($this->isCropped()) { |
| 131 | 131 | $path .= '-crop'; |
| 132 | 132 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $ext = $this->getExtension(); |
| 138 | - $path .= '.' . $ext; |
|
| 138 | + $path .= '.'.$ext; |
|
| 139 | 139 | return $path; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -57,9 +57,9 @@ |
||
| 57 | 57 | yield ['storageId' => $lastStorageId, 'fileIds' => $fileIds]; |
| 58 | 58 | $fileIds = []; |
| 59 | 59 | } |
| 60 | - $lastStorageId = (int)$row['storage_id']; |
|
| 60 | + $lastStorageId = (int) $row['storage_id']; |
|
| 61 | 61 | } |
| 62 | - $fileIds[] = (int)$row['file_id']; |
|
| 62 | + $fileIds[] = (int) $row['file_id']; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if (count($fileIds) > 0) { |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | $cursor = $qb->executeQuery(); |
| 86 | 86 | while ($row = $cursor->fetch()) { |
| 87 | - yield (int)$row['file_id']; |
|
| 87 | + yield (int) $row['file_id']; |
|
| 88 | 88 | } |
| 89 | 89 | $cursor->closeCursor(); |
| 90 | 90 | } |