@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */ |
| 38 | 38 | protected $config; |
| 39 | 39 | |
| 40 | - protected IEVentDispatcher|MockObject $dispatcher; |
|
| 40 | + protected IEVentDispatcher | MockObject $dispatcher; |
|
| 41 | 41 | |
| 42 | 42 | /** @var \OC\NavigationManager */ |
| 43 | 43 | protected $navigationManager; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | global $testAddClosureNumberOfCalls; |
| 148 | 148 | $testAddClosureNumberOfCalls = 0; |
| 149 | 149 | |
| 150 | - $this->navigationManager->add(function () use ($entry) { |
|
| 150 | + $this->navigationManager->add(function() use ($entry) { |
|
| 151 | 151 | global $testAddClosureNumberOfCalls; |
| 152 | 152 | $testAddClosureNumberOfCalls++; |
| 153 | 153 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | global $testAddClosureNumberOfCalls; |
| 200 | 200 | $testAddClosureNumberOfCalls = 0; |
| 201 | 201 | |
| 202 | - $this->navigationManager->add(function () use ($entry) { |
|
| 202 | + $this->navigationManager->add(function() use ($entry) { |
|
| 203 | 203 | global $testAddClosureNumberOfCalls; |
| 204 | 204 | $testAddClosureNumberOfCalls++; |
| 205 | 205 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function testWithAppManager($expected, $navigation, $isAdmin = false): void { |
| 220 | 220 | $l = $this->createMock(IL10N::class); |
| 221 | - $l->expects($this->any())->method('t')->willReturnCallback(function ($text, $parameters = []) { |
|
| 221 | + $l->expects($this->any())->method('t')->willReturnCallback(function($text, $parameters = []) { |
|
| 222 | 222 | return vsprintf($text, $parameters); |
| 223 | 223 | }); |
| 224 | 224 | |
@@ -236,14 +236,14 @@ discard block |
||
| 236 | 236 | ->willReturn($navigation); |
| 237 | 237 | $this->urlGenerator->expects($this->any()) |
| 238 | 238 | ->method('imagePath') |
| 239 | - ->willReturnCallback(function ($appName, $file) { |
|
| 239 | + ->willReturnCallback(function($appName, $file) { |
|
| 240 | 240 | return "/apps/$appName/img/$file"; |
| 241 | 241 | }); |
| 242 | 242 | $this->appManager->expects($this->any()) |
| 243 | 243 | ->method('getAppIcon') |
| 244 | 244 | ->willReturnCallback(fn (string $appName) => "/apps/$appName/img/app.svg"); |
| 245 | 245 | $this->l10nFac->expects($this->any())->method('get')->willReturn($l); |
| 246 | - $this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function ($route) { |
|
| 246 | + $this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function($route) { |
|
| 247 | 247 | if ($route === 'core.login.logout') { |
| 248 | 248 | return 'https://example.com/logout'; |
| 249 | 249 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $this->navigationManager->clear(); |
| 266 | 266 | $this->dispatcher->expects($this->once()) |
| 267 | 267 | ->method('dispatchTyped') |
| 268 | - ->willReturnCallback(function ($event) { |
|
| 268 | + ->willReturnCallback(function($event) { |
|
| 269 | 269 | $this->assertInstanceOf(LoadAdditionalEntriesEvent::class, $event); |
| 270 | 270 | }); |
| 271 | 271 | $entries = $this->navigationManager->getAll('all'); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | 'logout' => [ |
| 324 | 324 | 'id' => 'logout', |
| 325 | 325 | 'order' => 99999, |
| 326 | - 'href' => 'https://example.com/logout?requesttoken=' . urlencode(\OCP\Util::callRegister()), |
|
| 326 | + 'href' => 'https://example.com/logout?requesttoken='.urlencode(\OCP\Util::callRegister()), |
|
| 327 | 327 | 'icon' => '/apps/core/img/actions/logout.svg', |
| 328 | 328 | 'name' => 'Log out', |
| 329 | 329 | 'active' => false, |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | public function testWithAppManagerAndApporder(): void { |
| 505 | 505 | $l = $this->createMock(IL10N::class); |
| 506 | - $l->expects($this->any())->method('t')->willReturnCallback(function ($text, $parameters = []) { |
|
| 506 | + $l->expects($this->any())->method('t')->willReturnCallback(function($text, $parameters = []) { |
|
| 507 | 507 | return vsprintf($text, $parameters); |
| 508 | 508 | }); |
| 509 | 509 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | $this->config->method('getUserValue') |
| 533 | 533 | ->willReturnCallback( |
| 534 | - function (string $userId, string $appName, string $key, mixed $default = '') use ($testOrder) { |
|
| 534 | + function(string $userId, string $appName, string $key, mixed $default = '') use ($testOrder) { |
|
| 535 | 535 | $this->assertEquals('user001', $userId); |
| 536 | 536 | if ($key === 'apporder') { |
| 537 | 537 | return json_encode(['test' => ['app' => 'test', 'order' => $testOrder]]); |
@@ -547,10 +547,10 @@ discard block |
||
| 547 | 547 | $this->appManager->expects($this->once())->method('getAppInfo')->with('test')->willReturn($navigation); |
| 548 | 548 | $this->appManager->expects($this->once())->method('getAppIcon')->with('test')->willReturn('/apps/test/img/app.svg'); |
| 549 | 549 | $this->l10nFac->expects($this->any())->method('get')->willReturn($l); |
| 550 | - $this->urlGenerator->expects($this->any())->method('imagePath')->willReturnCallback(function ($appName, $file) { |
|
| 550 | + $this->urlGenerator->expects($this->any())->method('imagePath')->willReturnCallback(function($appName, $file) { |
|
| 551 | 551 | return "/apps/$appName/img/$file"; |
| 552 | 552 | }); |
| 553 | - $this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function ($route) { |
|
| 553 | + $this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function($route) { |
|
| 554 | 554 | if ($route === 'core.login.logout') { |
| 555 | 555 | return 'https://example.com/logout'; |
| 556 | 556 | } |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | $this->navigationManager->clear(); |
| 573 | 573 | $this->dispatcher->expects($this->once()) |
| 574 | 574 | ->method('dispatchTyped') |
| 575 | - ->willReturnCallback(function ($event) { |
|
| 575 | + ->willReturnCallback(function($event) { |
|
| 576 | 576 | $this->assertInstanceOf(LoadAdditionalEntriesEvent::class, $event); |
| 577 | 577 | }); |
| 578 | 578 | $entries = $this->navigationManager->getAll(); |
@@ -739,13 +739,13 @@ discard block |
||
| 739 | 739 | $this->navigationManager->add([ |
| 740 | 740 | 'id' => 'settings', |
| 741 | 741 | ]); |
| 742 | - $this->navigationManager->add(static function (): array { |
|
| 742 | + $this->navigationManager->add(static function(): array { |
|
| 743 | 743 | return [ |
| 744 | 744 | 'id' => 'closure1', |
| 745 | 745 | 'href' => '/closure1', |
| 746 | 746 | ]; |
| 747 | 747 | }); |
| 748 | - $this->navigationManager->add(static function (): array { |
|
| 748 | + $this->navigationManager->add(static function(): array { |
|
| 749 | 749 | return [ |
| 750 | 750 | 'id' => 'closure2', |
| 751 | 751 | 'href' => '/closure2', |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | public function linkToOCSRouteAbsolute(string $routeName, array $arguments = []): string { |
| 97 | 97 | // Returns `/subfolder/index.php/ocsapp/…` with `'htaccess.IgnoreFrontController' => false` in config.php |
| 98 | 98 | // And `/subfolder/ocsapp/…` with `'htaccess.IgnoreFrontController' => true` in config.php |
| 99 | - $route = $this->router->generate('ocs.' . $routeName, $arguments, false); |
|
| 99 | + $route = $this->router->generate('ocs.'.$routeName, $arguments, false); |
|
| 100 | 100 | |
| 101 | 101 | // Cut off `/subfolder` |
| 102 | 102 | if (\OC::$WEBROOT !== '' && str_starts_with($route, \OC::$WEBROOT)) { |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | // Remove `ocsapp/` bit |
| 111 | 111 | $route = substr($route, 7); |
| 112 | 112 | // Prefix with ocs/v2.php endpoint |
| 113 | - $route = '/ocs/v2.php' . $route; |
|
| 113 | + $route = '/ocs/v2.php'.$route; |
|
| 114 | 114 | |
| 115 | 115 | // Turn into an absolute URL |
| 116 | 116 | return $this->getAbsoluteURL($route); |
@@ -133,33 +133,33 @@ discard block |
||
| 133 | 133 | if ($appName !== '') { |
| 134 | 134 | $app_path = $this->getAppManager()->getAppPath($appName); |
| 135 | 135 | // Check if the app is in the app folder |
| 136 | - if (file_exists($app_path . '/' . $file)) { |
|
| 136 | + if (file_exists($app_path.'/'.$file)) { |
|
| 137 | 137 | if (str_ends_with($file, 'php')) { |
| 138 | - $urlLinkTo = \OC::$WEBROOT . '/index.php/apps/' . $appName; |
|
| 138 | + $urlLinkTo = \OC::$WEBROOT.'/index.php/apps/'.$appName; |
|
| 139 | 139 | if ($frontControllerActive) { |
| 140 | - $urlLinkTo = \OC::$WEBROOT . '/apps/' . $appName; |
|
| 140 | + $urlLinkTo = \OC::$WEBROOT.'/apps/'.$appName; |
|
| 141 | 141 | } |
| 142 | - $urlLinkTo .= ($file !== 'index.php') ? '/' . $file : ''; |
|
| 142 | + $urlLinkTo .= ($file !== 'index.php') ? '/'.$file : ''; |
|
| 143 | 143 | } else { |
| 144 | - $urlLinkTo = $this->getAppManager()->getAppWebPath($appName) . '/' . $file; |
|
| 144 | + $urlLinkTo = $this->getAppManager()->getAppWebPath($appName).'/'.$file; |
|
| 145 | 145 | } |
| 146 | 146 | } else { |
| 147 | - $urlLinkTo = \OC::$WEBROOT . '/' . $appName . '/' . $file; |
|
| 147 | + $urlLinkTo = \OC::$WEBROOT.'/'.$appName.'/'.$file; |
|
| 148 | 148 | } |
| 149 | 149 | } else { |
| 150 | - if (file_exists(\OC::$SERVERROOT . '/core/' . $file)) { |
|
| 151 | - $urlLinkTo = \OC::$WEBROOT . '/core/' . $file; |
|
| 150 | + if (file_exists(\OC::$SERVERROOT.'/core/'.$file)) { |
|
| 151 | + $urlLinkTo = \OC::$WEBROOT.'/core/'.$file; |
|
| 152 | 152 | } else { |
| 153 | 153 | if ($frontControllerActive && $file === 'index.php') { |
| 154 | - $urlLinkTo = \OC::$WEBROOT . '/'; |
|
| 154 | + $urlLinkTo = \OC::$WEBROOT.'/'; |
|
| 155 | 155 | } else { |
| 156 | - $urlLinkTo = \OC::$WEBROOT . '/' . $file; |
|
| 156 | + $urlLinkTo = \OC::$WEBROOT.'/'.$file; |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ($args && $query = http_build_query($args, '', '&')) { |
| 162 | - $urlLinkTo .= '?' . $query; |
|
| 162 | + $urlLinkTo .= '?'.$query; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $urlLinkTo; |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | * Returns the path to the image. |
| 177 | 177 | */ |
| 178 | 178 | public function imagePath(string $appName, string $file): string { |
| 179 | - $cache = $this->cacheFactory->createDistributed('imagePath-' . md5($this->getBaseUrl()) . '-'); |
|
| 180 | - $cacheKey = $appName . '-' . $file; |
|
| 179 | + $cache = $this->cacheFactory->createDistributed('imagePath-'.md5($this->getBaseUrl()).'-'); |
|
| 180 | + $cacheKey = $appName.'-'.$file; |
|
| 181 | 181 | if ($key = $cache->get($cacheKey)) { |
| 182 | 182 | return $key; |
| 183 | 183 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $appName = 'core'; |
| 196 | 196 | $appPath = false; |
| 197 | 197 | } else { |
| 198 | - throw new RuntimeException('image not found: image: ' . $file . ' webroot: ' . \OC::$WEBROOT . ' serverroot: ' . \OC::$SERVERROOT); |
|
| 198 | + throw new RuntimeException('image not found: image: '.$file.' webroot: '.\OC::$WEBROOT.' serverroot: '.\OC::$SERVERROOT); |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | |
@@ -210,38 +210,38 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - if (file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$file")) { |
|
| 214 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$file"; |
|
| 215 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$basename.svg") |
|
| 216 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/apps/$appName/img/$basename.png")) { |
|
| 217 | - $path = \OC::$WEBROOT . "/themes/$theme/apps/$appName/img/$basename.png"; |
|
| 218 | - } elseif (!empty($appName) and file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$file")) { |
|
| 219 | - $path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$file"; |
|
| 220 | - } elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$basename.svg") |
|
| 221 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/$appName/img/$basename.png"))) { |
|
| 222 | - $path = \OC::$WEBROOT . "/themes/$theme/$appName/img/$basename.png"; |
|
| 223 | - } elseif (file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$file")) { |
|
| 224 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$file"; |
|
| 225 | - } elseif (!file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.svg") |
|
| 226 | - && file_exists(\OC::$SERVERROOT . "/themes/$theme/core/img/$basename.png")) { |
|
| 227 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
| 213 | + if (file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$appName/img/$file")) { |
|
| 214 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$appName/img/$file"; |
|
| 215 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$appName/img/$basename.svg") |
|
| 216 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/apps/$appName/img/$basename.png")) { |
|
| 217 | + $path = \OC::$WEBROOT."/themes/$theme/apps/$appName/img/$basename.png"; |
|
| 218 | + } elseif (!empty($appName) and file_exists(\OC::$SERVERROOT."/themes/$theme/$appName/img/$file")) { |
|
| 219 | + $path = \OC::$WEBROOT."/themes/$theme/$appName/img/$file"; |
|
| 220 | + } elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT."/themes/$theme/$appName/img/$basename.svg") |
|
| 221 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/$appName/img/$basename.png"))) { |
|
| 222 | + $path = \OC::$WEBROOT."/themes/$theme/$appName/img/$basename.png"; |
|
| 223 | + } elseif (file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$file")) { |
|
| 224 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$file"; |
|
| 225 | + } elseif (!file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.svg") |
|
| 226 | + && file_exists(\OC::$SERVERROOT."/themes/$theme/core/img/$basename.png")) { |
|
| 227 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
| 228 | 228 | } elseif ($themingEnabled && $themingImagePath) { |
| 229 | 229 | $path = $themingImagePath; |
| 230 | - } elseif ($appPath && file_exists($appPath . "/img/$file")) { |
|
| 231 | - $path = $this->getAppManager()->getAppWebPath($appName) . "/img/$file"; |
|
| 232 | - } elseif ($appPath && !file_exists($appPath . "/img/$basename.svg") |
|
| 233 | - && file_exists($appPath . "/img/$basename.png")) { |
|
| 234 | - $path = $this->getAppManager()->getAppWebPath($appName) . "/img/$basename.png"; |
|
| 235 | - } elseif (!empty($appName) and file_exists(\OC::$SERVERROOT . "/$appName/img/$file")) { |
|
| 236 | - $path = \OC::$WEBROOT . "/$appName/img/$file"; |
|
| 237 | - } elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT . "/$appName/img/$basename.svg") |
|
| 238 | - && file_exists(\OC::$SERVERROOT . "/$appName/img/$basename.png"))) { |
|
| 239 | - $path = \OC::$WEBROOT . "/$appName/img/$basename.png"; |
|
| 240 | - } elseif (file_exists(\OC::$SERVERROOT . "/core/img/$file")) { |
|
| 241 | - $path = \OC::$WEBROOT . "/core/img/$file"; |
|
| 242 | - } elseif (!file_exists(\OC::$SERVERROOT . "/core/img/$basename.svg") |
|
| 243 | - && file_exists(\OC::$SERVERROOT . "/core/img/$basename.png")) { |
|
| 244 | - $path = \OC::$WEBROOT . "/themes/$theme/core/img/$basename.png"; |
|
| 230 | + } elseif ($appPath && file_exists($appPath."/img/$file")) { |
|
| 231 | + $path = $this->getAppManager()->getAppWebPath($appName)."/img/$file"; |
|
| 232 | + } elseif ($appPath && !file_exists($appPath."/img/$basename.svg") |
|
| 233 | + && file_exists($appPath."/img/$basename.png")) { |
|
| 234 | + $path = $this->getAppManager()->getAppWebPath($appName)."/img/$basename.png"; |
|
| 235 | + } elseif (!empty($appName) and file_exists(\OC::$SERVERROOT."/$appName/img/$file")) { |
|
| 236 | + $path = \OC::$WEBROOT."/$appName/img/$file"; |
|
| 237 | + } elseif (!empty($appName) and (!file_exists(\OC::$SERVERROOT."/$appName/img/$basename.svg") |
|
| 238 | + && file_exists(\OC::$SERVERROOT."/$appName/img/$basename.png"))) { |
|
| 239 | + $path = \OC::$WEBROOT."/$appName/img/$basename.png"; |
|
| 240 | + } elseif (file_exists(\OC::$SERVERROOT."/core/img/$file")) { |
|
| 241 | + $path = \OC::$WEBROOT."/core/img/$file"; |
|
| 242 | + } elseif (!file_exists(\OC::$SERVERROOT."/core/img/$basename.svg") |
|
| 243 | + && file_exists(\OC::$SERVERROOT."/core/img/$basename.png")) { |
|
| 244 | + $path = \OC::$WEBROOT."/themes/$theme/core/img/$basename.png"; |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if ($path !== '') { |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | return $path; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - throw new RuntimeException('image not found: image:' . $file . ' webroot:' . \OC::$WEBROOT . ' serverroot:' . \OC::$SERVERROOT); |
|
| 252 | + throw new RuntimeException('image not found: image:'.$file.' webroot:'.\OC::$WEBROOT.' serverroot:'.\OC::$SERVERROOT); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | |
@@ -262,14 +262,14 @@ discard block |
||
| 262 | 262 | $separator = str_starts_with($url, '/') ? '' : '/'; |
| 263 | 263 | |
| 264 | 264 | if (\OC::$CLI && !\defined('PHPUNIT_RUN')) { |
| 265 | - return rtrim($this->config->getSystemValueString('overwrite.cli.url'), '/') . '/' . ltrim($url, '/'); |
|
| 265 | + return rtrim($this->config->getSystemValueString('overwrite.cli.url'), '/').'/'.ltrim($url, '/'); |
|
| 266 | 266 | } |
| 267 | 267 | // The Nextcloud web root could already be prepended. |
| 268 | 268 | if (\OC::$WEBROOT !== '' && str_starts_with($url, \OC::$WEBROOT)) { |
| 269 | 269 | $url = substr($url, \strlen(\OC::$WEBROOT)); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - return $this->getBaseUrl() . $separator . $url; |
|
| 272 | + return $this->getBaseUrl().$separator.$url; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -300,9 +300,9 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | $entryId = $this->getNavigationManager()->getDefaultEntryIdForUser(); |
| 302 | 302 | $entry = $this->getNavigationManager()->get($entryId); |
| 303 | - $href = (string)$entry['href']; |
|
| 303 | + $href = (string) $entry['href']; |
|
| 304 | 304 | if ($href === '') { |
| 305 | - throw new \InvalidArgumentException('Default navigation entry is missing href: ' . $entryId); |
|
| 305 | + throw new \InvalidArgumentException('Default navigation entry is missing href: '.$entryId); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | if (str_starts_with($href, $this->getBaseUrl())) { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | public function getBaseUrl(): string { |
| 323 | 323 | // BaseUrl can be equal to 'http(s)://' during the first steps of the initial setup. |
| 324 | 324 | if ($this->baseUrl === null || $this->baseUrl === 'http://' || $this->baseUrl === 'https://') { |
| 325 | - $this->baseUrl = $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; |
|
| 325 | + $this->baseUrl = $this->request->getServerProtocol().'://'.$this->request->getServerHost().\OC::$WEBROOT; |
|
| 326 | 326 | } |
| 327 | 327 | return $this->baseUrl; |
| 328 | 328 | } |