Passed
Pull Request — master (#77)
by Daniel
02:37
created
lib/Settings/Admin.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 		$exampleProxyUrl = $this->urlGenerator->getBaseUrl() . '/sites/' . urlencode($exampleSite);
62 62
 		$exampleFullUrl = $this->urlGenerator->linkToRouteAbsolute(
63 63
 			Application::APP_NAME . '.Pico.getPage',
64
-			[ 'site' => $exampleSite, 'page' => '' ]
64
+			['site' => $exampleSite, 'page' => '']
65 65
 		);
66 66
 
67 67
 		$internalBaseUrl = $this->urlGenerator->getBaseUrl() . '/index.php/apps/' . Application::APP_NAME;
Please login to merge, or discard this patch.
lib/Model/Website.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 			/** @var OCFolder $viewerOCFolder */
235 235
 			$viewerOCFolder = $this->rootFolder->getUserFolder($this->getViewer());
236
-			$viewerAccessClosure = function (OCNode $node) use ($viewerOCFolder) {
236
+			$viewerAccessClosure = function(OCNode $node) use ($viewerOCFolder) {
237 237
 				$nodeId = $node->getId();
238 238
 
239 239
 				$viewerNodes = $viewerOCFolder->getById($nodeId);
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 	{
425 425
 		if (!$this->getProxyRequest()) {
426 426
 			$route = Application::APP_NAME . '.Pico.getPage';
427
-			$parameters = [ 'site' => $this->getSite(), 'page' => '' ];
427
+			$parameters = ['site' => $this->getSite(), 'page' => ''];
428 428
 			return $this->urlGenerator->linkToRoute($route, $parameters) . '/';
429 429
 		} else {
430 430
 			return \OC::$WEBROOT . '/sites/' . urlencode($this->getSite()) . '/';
Please login to merge, or discard this patch.
lib/Model/WebsiteCore.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Model/TemplateFile.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
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
 	 */
Please login to merge, or discard this patch.
lib/Controller/PicoController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,8 +56,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 		try {
151 151
 			$picoAsset = $this->websitesService->getAsset($site, $asset, $this->userId);
152 152
 
153
-			$response = new PicoAssetResponse($picoAsset, (bool) $assetsETag);
153
+			$response = new PicoAssetResponse($picoAsset, (bool)$assetsETag);
154 154
 
155 155
 			$assetETag = $picoAsset->getETag();
156 156
 			$clientETag = $this->request->getHeader('If-None-Match');
Please login to merge, or discard this patch.
lib/Controller/SettingsController.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
lib/Http/PicoContentSecurityPolicy.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Http/NotModifiedResponse.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Http/PicoPageResponse.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,8 +28,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.