@@ -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 |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function getPersonalWebsites(): DataResponse |
117 | 117 | { |
118 | - $data = [ 'websites' => $this->websitesService->getWebsitesFromUser($this->userId) ]; |
|
118 | + $data = ['websites' => $this->websitesService->getWebsitesFromUser($this->userId)]; |
|
119 | 119 | return new DataResponse($data, Http::STATUS_OK); |
120 | 120 | } |
121 | 121 | |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | } catch (\Exception $e) { |
144 | 144 | $data = []; |
145 | 145 | if ($e instanceof WebsiteExistsException) { |
146 | - $data['form_error'] = [ 'field' => 'site', 'message' => $this->l10n->t('Website exists.') ]; |
|
146 | + $data['form_error'] = ['field' => 'site', 'message' => $this->l10n->t('Website exists.')]; |
|
147 | 147 | } elseif (($e instanceof WebsiteInvalidDataException) && $e->getField()) { |
148 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
148 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
149 | 149 | } elseif ($e instanceof ThemeNotFoundException) { |
150 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
150 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
151 | 151 | } elseif ($e instanceof ThemeNotCompatibleException) { |
152 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t($e->getReason()) ]; |
|
152 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t($e->getReason())]; |
|
153 | 153 | } elseif ($e instanceof TemplateNotFoundException) { |
154 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
154 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return $this->createErrorResponse($e, $data); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | foreach ($data as $key => $value) { |
177 | 177 | switch ($key) { |
178 | 178 | case 'type': |
179 | - $website->setType((int) $value); |
|
179 | + $website->setType((int)$value); |
|
180 | 180 | break; |
181 | 181 | |
182 | 182 | case 'theme': |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | } catch (\Exception $e) { |
195 | 195 | $data = []; |
196 | 196 | if (($e instanceof WebsiteNotFoundException) || ($e instanceof WebsiteForeignOwnerException)) { |
197 | - $data['form_error'] = [ 'field' => 'identifier', 'message' => $this->l10n->t('Website not found.') ]; |
|
197 | + $data['form_error'] = ['field' => 'identifier', 'message' => $this->l10n->t('Website not found.')]; |
|
198 | 198 | } elseif ($e instanceof WebsiteInvalidDataException) { |
199 | - $data['form_error'] = [ 'field' => $e->getField(), 'message' => $e->getMessage() ]; |
|
199 | + $data['form_error'] = ['field' => $e->getField(), 'message' => $e->getMessage()]; |
|
200 | 200 | } elseif ($e instanceof ThemeNotFoundException) { |
201 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t('Theme not found.') ]; |
|
201 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t('Theme not found.')]; |
|
202 | 202 | } elseif ($e instanceof ThemeNotCompatibleException) { |
203 | - $data['form_error'] = [ 'field' => 'theme', 'message' => $this->l10n->t($e->getReason()) ]; |
|
203 | + $data['form_error'] = ['field' => 'theme', 'message' => $this->l10n->t($e->getReason())]; |
|
204 | 204 | } elseif ($e instanceof TemplateNotFoundException) { |
205 | - $data['form_error'] = [ 'field' => 'template', 'message' => $this->l10n->t('Template not found.') ]; |
|
205 | + $data['form_error'] = ['field' => 'template', 'message' => $this->l10n->t('Template not found.')]; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | return $this->createErrorResponse($e, $data); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | throw new \UnexpectedValueException(); |
430 | 430 | } |
431 | 431 | |
432 | - $this->websitesService->setLinkMode((int) $data['link_mode']); |
|
432 | + $this->websitesService->setLinkMode((int)$data['link_mode']); |
|
433 | 433 | |
434 | 434 | return new DataResponse([], Http::STATUS_CREATED); |
435 | 435 | } catch (\Exception $e) { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | private function createErrorResponse(\Exception $exception, array $data = []): DataResponse |
447 | 447 | { |
448 | - $this->logger->logException($exception, [ 'app' => Application::APP_NAME, 'level' => 2 ]); |
|
448 | + $this->logger->logException($exception, ['app' => Application::APP_NAME, 'level' => 2]); |
|
449 | 449 | |
450 | 450 | $data['status'] = 0; |
451 | 451 | 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 |
@@ -27,8 +27,7 @@ |
||
27 | 27 | use OCP\AppFramework\Http; |
28 | 28 | use OCP\AppFramework\Http\Response; |
29 | 29 | |
30 | -class NotModifiedResponse extends Response |
|
31 | -{ |
|
30 | +class NotModifiedResponse extends Response { |
|
32 | 31 | /** @var Response */ |
33 | 32 | private $originalResponse; |
34 | 33 |
@@ -28,8 +28,7 @@ |
||
28 | 28 | use OCP\AppFramework\Http\EmptyContentSecurityPolicy; |
29 | 29 | use OCP\AppFramework\Http\Response; |
30 | 30 | |
31 | -class PicoPageResponse extends Response |
|
32 | -{ |
|
31 | +class PicoPageResponse extends Response { |
|
33 | 32 | /** @var PicoPage */ |
34 | 33 | private $page; |
35 | 34 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function __construct(string $message = null) |
39 | 39 | { |
40 | - parent::__construct(Application::APP_NAME, '404', [ 'message' => $message ], 'guest'); |
|
40 | + parent::__construct(Application::APP_NAME, '404', ['message' => $message], 'guest'); |
|
41 | 41 | $this->setStatus(Http::STATUS_NOT_FOUND); |
42 | 42 | } |
43 | 43 | } |
@@ -28,8 +28,7 @@ |
||
28 | 28 | use OCP\AppFramework\Http; |
29 | 29 | use OCP\AppFramework\Http\TemplateResponse; |
30 | 30 | |
31 | -class NotFoundResponse extends TemplateResponse |
|
32 | -{ |
|
31 | +class NotFoundResponse extends TemplateResponse { |
|
33 | 32 | /** |
34 | 33 | * NotFoundResponse constructor. |
35 | 34 | * |
@@ -28,8 +28,7 @@ |
||
28 | 28 | use OCP\AppFramework\Http; |
29 | 29 | use OCP\AppFramework\Http\TemplateResponse; |
30 | 30 | |
31 | -class PicoErrorResponse extends TemplateResponse |
|
32 | -{ |
|
31 | +class PicoErrorResponse extends TemplateResponse { |
|
33 | 32 | /** @var \Exception|null */ |
34 | 33 | private $exception; |
35 | 34 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | public function __construct(string $message = null) |
39 | 39 | { |
40 | - parent::__construct(Application::APP_NAME, '403', [ 'message' => $message ], 'guest'); |
|
40 | + parent::__construct(Application::APP_NAME, '403', ['message' => $message], 'guest'); |
|
41 | 41 | $this->setStatus(Http::STATUS_FORBIDDEN); |
42 | 42 | } |
43 | 43 | } |
@@ -28,8 +28,7 @@ |
||
28 | 28 | use OCP\AppFramework\Http; |
29 | 29 | use OCP\AppFramework\Http\TemplateResponse; |
30 | 30 | |
31 | -class NotPermittedResponse extends TemplateResponse |
|
32 | -{ |
|
31 | +class NotPermittedResponse extends TemplateResponse { |
|
33 | 32 | /** |
34 | 33 | * NotPermittedResponse constructor. |
35 | 34 | * |
@@ -28,8 +28,7 @@ |
||
28 | 28 | use OCP\AppFramework\App; |
29 | 29 | use OCP\Util; |
30 | 30 | |
31 | -class Application extends App |
|
32 | -{ |
|
31 | +class Application extends App { |
|
33 | 32 | /** @var string */ |
34 | 33 | const APP_NAME = 'cms_pico'; |
35 | 34 |
@@ -41,8 +41,7 @@ |
||
41 | 41 | use OCP\Files\NotPermittedException; |
42 | 42 | use OCP\ILogger; |
43 | 43 | |
44 | -class PicoService |
|
45 | -{ |
|
44 | +class PicoService { |
|
46 | 45 | /** @var string */ |
47 | 46 | const DIR_TEMPLATES = 'templates'; |
48 | 47 |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | throw $e; |
156 | 156 | } catch (\Exception $e) { |
157 | 157 | $exception = new PicoRuntimeException($e); |
158 | - $this->logger->logException($exception, [ 'app' => Application::APP_NAME ]); |
|
158 | + $this->logger->logException($exception, ['app' => Application::APP_NAME]); |
|
159 | 159 | throw $exception; |
160 | 160 | } |
161 | 161 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | */ |
211 | 211 | private function loadPicoPlugins(Pico $pico) |
212 | 212 | { |
213 | - $includeClosure = static function (string $pluginFile) { |
|
213 | + $includeClosure = static function(string $pluginFile) { |
|
214 | 214 | /** @noinspection PhpIncludeInspection */ |
215 | 215 | require($pluginFile); |
216 | 216 | }; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | } |
276 | 276 | } |
277 | 277 | |
278 | - return [ $folder, rtrim($basePath, '/'), $relativePath ]; |
|
278 | + return [$folder, rtrim($basePath, '/'), $relativePath]; |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | /** |