@@ -125,6 +125,6 @@ |
||
| 125 | 125 | */ |
| 126 | 126 | public function getPermissions(): int |
| 127 | 127 | { |
| 128 | - return Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE; |
|
| 128 | + return Constants::PERMISSION_READ|Constants::PERMISSION_UPDATE|Constants::PERMISSION_DELETE; |
|
| 129 | 129 | } |
| 130 | 130 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function isReadable(): bool |
| 93 | 93 | { |
| 94 | - return ($this->getPermissions() & Constants::PERMISSION_READ) === Constants::PERMISSION_READ; |
|
| 94 | + return ($this->getPermissions()&Constants::PERMISSION_READ) === Constants::PERMISSION_READ; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function isUpdateable(): bool |
| 101 | 101 | { |
| 102 | - return ($this->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE; |
|
| 102 | + return ($this->getPermissions()&Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,6 +107,6 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function isDeletable(): bool |
| 109 | 109 | { |
| 110 | - return ($this->getPermissions() & Constants::PERMISSION_DELETE) === Constants::PERMISSION_DELETE; |
|
| 110 | + return ($this->getPermissions()&Constants::PERMISSION_DELETE) === Constants::PERMISSION_DELETE; |
|
| 111 | 111 | } |
| 112 | 112 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (!@rmdir($this->getLocalPath())) { |
| 71 | 71 | $files = @scandir($this->getLocalPath()); |
| 72 | - if (($files === false) || ($files === [ '.', '..' ])) { |
|
| 72 | + if (($files === false) || ($files === ['.', '..'])) { |
|
| 73 | 73 | throw new GenericFileException(); |
| 74 | 74 | } else { |
| 75 | 75 | throw new NotPermittedException(); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | */ |
| 204 | 204 | public function isCreatable(): bool |
| 205 | 205 | { |
| 206 | - return ($this->getPermissions() & Constants::PERMISSION_CREATE) === Constants::PERMISSION_CREATE; |
|
| 206 | + return ($this->getPermissions()&Constants::PERMISSION_CREATE) === Constants::PERMISSION_CREATE; |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | $exampleProxyUrl = $this->urlGenerator->getBaseUrl() . '/sites/' . urlencode($exampleSite) . '/'; |
| 71 | 71 | $exampleFullUrl = $this->urlGenerator->linkToRouteAbsolute( |
| 72 | 72 | Application::APP_NAME . '.Pico.getRoot', |
| 73 | - [ 'site' => $exampleSite ] |
|
| 73 | + ['site' => $exampleSite] |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | $baseUrl = $this->urlGenerator->getBaseUrl() . '/index.php/apps/' . Application::APP_NAME . '/pico/'; |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | $exampleProxyUrl = $this->urlGenerator->getBaseUrl() . '/sites/' . urlencode($exampleSite) . '/'; |
| 62 | 62 | $exampleFullUrl = $this->urlGenerator->linkToRouteAbsolute( |
| 63 | 63 | Application::APP_NAME . '.Pico.getRoot', |
| 64 | - [ 'site' => $exampleSite ] |
|
| 64 | + ['site' => $exampleSite] |
|
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | 67 | $internalBaseUrl = $this->urlGenerator->getBaseUrl() . '/index.php/apps/' . Application::APP_NAME . '/'; |
@@ -135,7 +135,7 @@ |
||
| 135 | 135 | { |
| 136 | 136 | if (!$this->getProxyRequest()) { |
| 137 | 137 | $route = Application::APP_NAME . '.Pico.getRoot'; |
| 138 | - $parameters = [ 'site' => $this->getSite() ]; |
|
| 138 | + $parameters = ['site' => $this->getSite()]; |
|
| 139 | 139 | return $this->urlGenerator->linkToRoute($route, $parameters); |
| 140 | 140 | } else { |
| 141 | 141 | return \OC::$WEBROOT . '/sites/' . urlencode($this->getSite()) . '/'; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function setType(int $type): self |
| 190 | 190 | { |
| 191 | - if (!in_array($type, [ self::TYPE_PUBLIC, self::TYPE_PRIVATE ], true)) { |
|
| 191 | + if (!in_array($type, [self::TYPE_PUBLIC, self::TYPE_PRIVATE], true)) { |
|
| 192 | 192 | throw new \UnexpectedValueException(); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -411,15 +411,15 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | $creation = 0; |
| 413 | 413 | if (!empty($data['creation'])) { |
| 414 | - $creation = is_numeric($data['creation']) ? (int) $data['creation'] : strtotime($data['creation']); |
|
| 414 | + $creation = is_numeric($data['creation']) ? (int)$data['creation'] : strtotime($data['creation']); |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - $this->setId(isset($data['id']) ? (int) $data['id'] : 0) |
|
| 417 | + $this->setId(isset($data['id']) ? (int)$data['id'] : 0) |
|
| 418 | 418 | ->setUserId($data['user_id']) |
| 419 | 419 | ->setName($data['name']) |
| 420 | 420 | ->setSite($data['site']) |
| 421 | 421 | ->setTheme($data['theme'] ?? 'default') |
| 422 | - ->setType(isset($data['type']) ? (int) $data['type'] : self::TYPE_PUBLIC) |
|
| 422 | + ->setType(isset($data['type']) ? (int)$data['type'] : self::TYPE_PUBLIC) |
|
| 423 | 423 | ->setOptions($options) |
| 424 | 424 | ->setPath($data['path']) |
| 425 | 425 | ->setCreation($creation) |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getPersonalWebsites(): DataResponse |
| 110 | 110 | { |
| 111 | - $data = [ 'websites' => $this->websitesService->getWebsitesFromUser($this->userId) ]; |
|
| 111 | + $data = ['websites' => $this->websitesService->getWebsitesFromUser($this->userId)]; |
|
| 112 | 112 | return new DataResponse($data, Http::STATUS_OK); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | } catch (\Exception $e) { |
| 137 | 137 | $data = []; |
| 138 | 138 | if ($e instanceof WebsiteExistsException) { |
| 139 | - $data['form_error'] = [ 'field' => 'site', 'message' => $this->l10n->t('Website exists.') ]; |
|
| 139 | + $data['form_error'] = ['field' => 'site', 'message' => $this->l10n->t('Website exists.')]; |
|
| 140 | 140 | } elseif (($e instanceof WebsiteInvalidDataException) && $e->getField()) { |
| 141 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
| 141 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
| 142 | 142 | } elseif ($e instanceof ThemeNotFoundException) { |
| 143 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
| 143 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
| 144 | 144 | } elseif ($e instanceof TemplateNotFoundException) { |
| 145 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
| 145 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | return $this->createErrorResponse($e, $data); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | foreach ($data as $key => $value) { |
| 168 | 168 | switch ($key) { |
| 169 | 169 | case 'type': |
| 170 | - $website->setType((int) $value); |
|
| 170 | + $website->setType((int)$value); |
|
| 171 | 171 | break; |
| 172 | 172 | |
| 173 | 173 | case 'theme': |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | } catch (\Exception $e) { |
| 186 | 186 | $data = []; |
| 187 | 187 | if (($e instanceof WebsiteNotFoundException) || ($e instanceof WebsiteForeignOwnerException)) { |
| 188 | - $data['form_error'] = [ 'field' => 'identifier', 'message' => $this->l10n->t('Website not found.') ]; |
|
| 188 | + $data['form_error'] = ['field' => 'identifier', 'message' => $this->l10n->t('Website not found.')]; |
|
| 189 | 189 | } elseif ($e instanceof WebsiteInvalidDataException) { |
| 190 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
| 190 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
| 191 | 191 | } elseif ($e instanceof ThemeNotFoundException) { |
| 192 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
| 192 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
| 193 | 193 | } elseif ($e instanceof TemplateNotFoundException) { |
| 194 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
| 194 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | return $this->createErrorResponse($e, $data); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | private function createErrorResponse(\Exception $exception, array $data = []): DataResponse |
| 370 | 370 | { |
| 371 | - $this->logger->logException($exception, [ 'app' => Application::APP_NAME, 'level' => 2 ]); |
|
| 371 | + $this->logger->logException($exception, ['app' => Application::APP_NAME, 'level' => 2]); |
|
| 372 | 372 | |
| 373 | 373 | $data['status'] = 0; |
| 374 | 374 | if (\OC::$server->getSystemConfig()->getValue('debug', false)) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $lastModified = $file->getMTime(); |
| 77 | 77 | $mimeType = $file->getMimeType(); |
| 78 | 78 | |
| 79 | - if (($file->getPermissions() & Constants::PERMISSION_READ) !== Constants::PERMISSION_READ) { |
|
| 79 | + if (($file->getPermissions()&Constants::PERMISSION_READ) !== Constants::PERMISSION_READ) { |
|
| 80 | 80 | throw new NotPermittedException(); |
| 81 | 81 | } |
| 82 | 82 | } catch (InvalidPathException $e) { |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function cacheFor(int $cacheSeconds): self |
| 124 | 124 | { |
| 125 | - if($cacheSeconds > 0) { |
|
| 125 | + if ($cacheSeconds > 0) { |
|
| 126 | 126 | $this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', public'); |
| 127 | 127 | $this->addHeader('Pragma', 'public'); |
| 128 | 128 | |