@@ -33,8 +33,7 @@ |
||
33 | 33 | use OCP\IURLGenerator; |
34 | 34 | use OCP\Settings\ISettings; |
35 | 35 | |
36 | -class Personal implements ISettings |
|
37 | -{ |
|
36 | +class Personal implements ISettings { |
|
38 | 37 | /** @var IURLGenerator */ |
39 | 38 | private $urlGenerator; |
40 | 39 |
@@ -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 . '/'; |
@@ -32,8 +32,7 @@ |
||
32 | 32 | use OCP\IURLGenerator; |
33 | 33 | use OCP\Settings\ISettings; |
34 | 34 | |
35 | -class Admin implements ISettings |
|
36 | -{ |
|
35 | +class Admin implements ISettings { |
|
37 | 36 | /** @var IURLGenerator */ |
38 | 37 | private $urlGenerator; |
39 | 38 |
@@ -30,8 +30,7 @@ |
||
30 | 30 | use OCA\CMSPico\Service\PicoService; |
31 | 31 | use Pico; |
32 | 32 | |
33 | -class PicoPage |
|
34 | -{ |
|
33 | +class PicoPage { |
|
35 | 34 | /** @var Pico */ |
36 | 35 | private $pico; |
37 | 36 |
@@ -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()) . '/'; |
@@ -52,8 +52,7 @@ |
||
52 | 52 | use OCP\IL10N; |
53 | 53 | use OCP\IURLGenerator; |
54 | 54 | |
55 | -class Website extends WebsiteCore |
|
56 | -{ |
|
55 | +class Website extends WebsiteCore { |
|
57 | 56 | /** @var int */ |
58 | 57 | const SITE_LENGTH_MIN = 3; |
59 | 58 |
@@ -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) |
@@ -25,8 +25,7 @@ |
||
25 | 25 | |
26 | 26 | namespace OCA\CMSPico\Model; |
27 | 27 | |
28 | -class WebsiteCore implements \JsonSerializable |
|
29 | -{ |
|
28 | +class WebsiteCore implements \JsonSerializable { |
|
30 | 29 | /** @var int */ |
31 | 30 | const TYPE_PUBLIC = 1; |
32 | 31 |
@@ -27,8 +27,7 @@ |
||
27 | 27 | |
28 | 28 | use OCA\CMSPico\Files\MemoryFile; |
29 | 29 | |
30 | -class TemplateFile extends MemoryFile |
|
31 | -{ |
|
30 | +class TemplateFile extends MemoryFile { |
|
32 | 31 | /** |
33 | 32 | * @param array<string,string> $data |
34 | 33 | */ |
@@ -56,8 +56,7 @@ |
||
56 | 56 | use OCP\IL10N; |
57 | 57 | use OCP\IRequest; |
58 | 58 | |
59 | -class PicoController extends Controller |
|
60 | -{ |
|
59 | +class PicoController extends Controller { |
|
61 | 60 | /** @var string|null */ |
62 | 61 | private $userId; |
63 | 62 |
@@ -45,8 +45,7 @@ |
||
45 | 45 | use OCP\ILogger; |
46 | 46 | use OCP\IRequest; |
47 | 47 | |
48 | -class SettingsController extends Controller |
|
49 | -{ |
|
48 | +class SettingsController extends Controller { |
|
50 | 49 | /** @var string */ |
51 | 50 | private $userId; |
52 | 51 |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function getPersonalWebsites(): DataResponse |
116 | 116 | { |
117 | - $data = [ 'websites' => $this->websitesService->getWebsitesFromUser($this->userId) ]; |
|
117 | + $data = ['websites' => $this->websitesService->getWebsitesFromUser($this->userId)]; |
|
118 | 118 | return new DataResponse($data, Http::STATUS_OK); |
119 | 119 | } |
120 | 120 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | } catch (\Exception $e) { |
143 | 143 | $data = []; |
144 | 144 | if ($e instanceof WebsiteExistsException) { |
145 | - $data['form_error'] = [ 'field' => 'site', 'message' => $this->l10n->t('Website exists.') ]; |
|
145 | + $data['form_error'] = ['field' => 'site', 'message' => $this->l10n->t('Website exists.')]; |
|
146 | 146 | } elseif (($e instanceof WebsiteInvalidDataException) && $e->getField()) { |
147 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
147 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
148 | 148 | } elseif ($e instanceof ThemeNotFoundException) { |
149 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
149 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
150 | 150 | } elseif ($e instanceof TemplateNotFoundException) { |
151 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
151 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | return $this->createErrorResponse($e, $data); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | foreach ($data as $key => $value) { |
174 | 174 | switch ($key) { |
175 | 175 | case 'type': |
176 | - $website->setType((int) $value); |
|
176 | + $website->setType((int)$value); |
|
177 | 177 | break; |
178 | 178 | |
179 | 179 | case 'theme': |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | } catch (\Exception $e) { |
192 | 192 | $data = []; |
193 | 193 | if (($e instanceof WebsiteNotFoundException) || ($e instanceof WebsiteForeignOwnerException)) { |
194 | - $data['form_error'] = [ 'field' => 'identifier', 'message' => $this->l10n->t('Website not found.') ]; |
|
194 | + $data['form_error'] = ['field' => 'identifier', 'message' => $this->l10n->t('Website not found.')]; |
|
195 | 195 | } elseif ($e instanceof WebsiteInvalidDataException) { |
196 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
196 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
197 | 197 | } elseif ($e instanceof ThemeNotFoundException) { |
198 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
198 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
199 | 199 | } elseif ($e instanceof TemplateNotFoundException) { |
200 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
200 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return $this->createErrorResponse($e, $data); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | throw new \UnexpectedValueException(); |
442 | 442 | } |
443 | 443 | |
444 | - $this->websitesService->setLinkMode((int) $data['link_mode']); |
|
444 | + $this->websitesService->setLinkMode((int)$data['link_mode']); |
|
445 | 445 | |
446 | 446 | return new DataResponse([], Http::STATUS_CREATED); |
447 | 447 | } catch (\Exception $e) { |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | private function createErrorResponse(\Exception $exception, array $data = []): DataResponse |
459 | 459 | { |
460 | - $this->logger->logException($exception, [ 'app' => Application::APP_NAME, 'level' => 2 ]); |
|
460 | + $this->logger->logException($exception, ['app' => Application::APP_NAME, 'level' => 2]); |
|
461 | 461 | |
462 | 462 | $data['status'] = 0; |
463 | 463 | if (\OC::$server->getSystemConfig()->getValue('debug', false)) { |
@@ -26,8 +26,7 @@ |
||
26 | 26 | |
27 | 27 | use OCP\AppFramework\Http\EmptyContentSecurityPolicy; |
28 | 28 | |
29 | -class PicoContentSecurityPolicy extends EmptyContentSecurityPolicy |
|
30 | -{ |
|
29 | +class PicoContentSecurityPolicy extends EmptyContentSecurityPolicy { |
|
31 | 30 | /** @var bool Whether inline JS snippets are allowed */ |
32 | 31 | protected $inlineScriptAllowed = true; |
33 | 32 |