Test Failed
Push — develop ( ff58ad...b8f9b2 )
by steve
13:44 queued 12s
created
neon/phoebe/controllers/database/IndexController.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function actionEdit($type = null)
56 56
 	{
57
-		if (!$this->canDevelop())
58
-			throw new HttpException(403, 'This operation is not permitted here');
57
+		if (!$this->canDevelop()) {
58
+					throw new HttpException(403, 'This operation is not permitted here');
59
+		}
59 60
 
60 61
 		$form = $this->getPhoebeForm($type, $isNewForm, false, true);
61 62
 		return $this->render('edit-fields', [
@@ -95,9 +96,13 @@  discard block
 block discarded – undo
95 96
 				// register all form field js scripts
96 97
 				$f->registerScripts(neon()->view);
97 98
 				$class = substr($class, 1);
98
-				if (in_array($class, $exclude)) continue;
99
+				if (in_array($class, $exclude)) {
100
+					continue;
101
+				}
99 102
 				$details = $f->getComponentDetails();
100
-				if ($details === false) continue;
103
+				if ($details === false) {
104
+					continue;
105
+				}
101 106
 				$defaultField = Arr::except($f->toArray(), ['dataKey']);
102 107
 				$cmp = Arr::merge($defaultField, [
103 108
 					'class' => $class,
@@ -162,8 +167,9 @@  discard block
 block discarded – undo
162 167
 			]
163 168
 		];
164 169
 		$form = new \neon\core\form\Form($formDefinition);
165
-		if (neon()->request->isAjax)
166
-			return $form->ajaxValidation();
170
+		if (neon()->request->isAjax) {
171
+					return $form->ajaxValidation();
172
+		}
167 173
 		if ($form->processRequest()) {
168 174
 			$data = $form->getData();
169 175
 			$definition = $this->canonicaliseDefinition($data);
Please login to merge, or discard this patch.
neon/cms/form/fields/ImageCompare.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,14 +48,14 @@
 block discarded – undo
48 48
 		];
49 49
     }
50 50
     
51
-    public function getValueDisplay($context='')
51
+    public function getValueDisplay($context = '')
52 52
 	{
53 53
 		$json = $this->getValue();
54 54
 		if (empty($json))
55 55
 			return neon()->formatter->asJson($this->getValue());
56
-		if ($context==='grid') {
56
+		if ($context === 'grid') {
57 57
 			$out = '';
58
-			foreach($json as $image) {
58
+			foreach ($json as $image) {
59 59
 				$url = neon()->firefly->getImage($image);
60 60
 				$out .= "<img src='$url' />";
61 61
 			}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
     public function getValueDisplay($context='')
52 52
 	{
53 53
 		$json = $this->getValue();
54
-		if (empty($json))
55
-			return neon()->formatter->asJson($this->getValue());
54
+		if (empty($json)) {
55
+					return neon()->formatter->asJson($this->getValue());
56
+		}
56 57
 		if ($context==='grid') {
57 58
 			$out = '';
58 59
 			foreach($json as $image) {
Please login to merge, or discard this patch.
neon/firefly/services/FileManager.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
 		neon()->firefly->isFileObjectValid($file);
67 67
 		$stream = fopen($file->getRealPath(), 'r+');
68 68
 		$uuid = $this->save($stream, $file->getFilename(), $meta);
69
-		if (is_resource($stream)) fclose($stream);
69
+		if (is_resource($stream)) {
70
+			fclose($stream);
71
+		}
70 72
 		return $uuid;
71 73
 	}
72 74
 
@@ -105,8 +107,9 @@  discard block
 block discarded – undo
105 107
 			->orWhere(['data_type_ref' => 'file_ref_multi'])
106 108
 			->all();
107 109
 			
108
-		if (empty($all))
109
-			return [];
110
+		if (empty($all)) {
111
+					return [];
112
+		}
110 113
 
111 114
 		$q = new Query();
112 115
 		foreach ($all as $i => $field) {
@@ -249,7 +252,9 @@  discard block
 block discarded – undo
249 252
 	public function destroy($uuid)
250 253
 	{
251 254
 		$file = Model::findWithDeleted()->where(['uuid' => $uuid])->one();
252
-		if ($file === null) return false;
255
+		if ($file === null) {
256
+			return false;
257
+		}
253 258
 		return $file->destroy();
254 259
 	}
255 260
 
@@ -332,7 +337,9 @@  discard block
 block discarded – undo
332 337
 			$driver = $this->getDriveFor($uuid, $file);
333 338
 			$hash = $driver->hash($file['path']);
334 339
 			$model = $this->_get($uuid);
335
-			if (!$hash) return false;
340
+			if (!$hash) {
341
+				return false;
342
+			}
336 343
 			$model->file_hash = $hash;
337 344
 			$model->save();
338 345
 		}
@@ -396,8 +403,9 @@  discard block
 block discarded – undo
396 403
 	{
397 404
 		$model = $this->_get($uuid);
398 405
 		$model->attributes = $updates;
399
-		if (!$model->save())
400
-			throw new HttpException(400, $model->getErrors());
406
+		if (!$model->save()) {
407
+					throw new HttpException(400, $model->getErrors());
408
+		}
401 409
 		return $model->toArray();
402 410
 	}
403 411
 
@@ -411,8 +419,9 @@  discard block
 block discarded – undo
411 419
 	public function findFile($drive, $path)
412 420
 	{
413 421
 		$model = Model::find()->where(['drive' => $drive, 'path' => $path])->one();
414
-		if ($model === null)
415
-			return null;
422
+		if ($model === null) {
423
+					return null;
424
+		}
416 425
 		return $model->toArray();
417 426
 	}
418 427
 
Please login to merge, or discard this patch.
neon/firefly/services/ImageManager.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 
82 82
 		if (Arr::get($params, 'fit', false)) {
83 83
 			// add callback functionality to retain maximal original image size
84
-			$image->fit($width, $height, function ($constraint) {
84
+			$image->fit($width, $height, function($constraint) {
85 85
 				$constraint->aspectRatio();
86 86
 				$constraint->upsize();
87 87
 			}, $params['fit']);
88 88
 		} elseif ($width || $height) {
89 89
 			$width = $width * $pd;
90 90
 			$height = $height * $pd;
91
-			$image->resize($width, $height, function ($constraint) {
91
+			$image->resize($width, $height, function($constraint) {
92 92
 				$constraint->aspectRatio();
93 93
 				$constraint->upsize();
94 94
 			});
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	{
135 135
 		$filter = Arr::get($params, 'filter', false);
136 136
 		if ($filter) {
137
-			$filters = explode(',',$filter);
137
+			$filters = explode(',', $filter);
138 138
 			if (in_array('greyscale', $filters, true)) {
139 139
 				$image->greyscale();
140 140
 			}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 				$x = Arr::get($crop, 'x', null);
170 170
 				$y = Arr::get($crop, 'y', null);
171 171
 			}
172
-			if ($w == 0 && $h == 0 && $x == 0 && $y ==0) {
172
+			if ($w == 0 && $h == 0 && $x == 0 && $y == 0) {
173 173
 				return $image;
174 174
 			}
175 175
 			$image->crop($w, $h, $x, $y);
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,11 +38,13 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		// get firefly image if the source is a firefly id
40 40
 		if (Hash::isUuid64($source)) {
41
-			if (!neon()->firefly->fileManager->exists($source))
42
-				throw new HttpException(404);
41
+			if (!neon()->firefly->fileManager->exists($source)) {
42
+							throw new HttpException(404);
43
+			}
43 44
 			$meta = neon()->firefly->fileManager->getMeta($source);
44
-			if ($meta['mime_type'] == 'image/svg')
45
-				return neon()->firefly->fileManager->read($source);
45
+			if ($meta['mime_type'] == 'image/svg') {
46
+							return neon()->firefly->fileManager->read($source);
47
+			}
46 48
 			$source = neon()->firefly->fileManager->readStream($source);
47 49
 		}
48 50
 		$manager = new InterventionImageManager();
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	public function imageRotate(Image & $image, $params)
104 106
 	{
105 107
 		$rotate = Arr::get($params, 'rotate', false);
106
-		if ($rotate) $image->rotate($rotate);
108
+		if ($rotate) {
109
+			$image->rotate($rotate);
110
+		}
107 111
 	}
108 112
 
109 113
 	/**
Please login to merge, or discard this patch.
neon/firefly/controllers/FileController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$id = $request->get('id');
38 38
 		if (!$firefly->fileManager->exists($id)) {
39 39
 			// show placeholder image - should be handled by image manager - controllers should not know
40
-			return neon()->response->sendFile(dirname(__DIR__) . '/assets/placeholder.jpg', 'No File', ['inline' => true]);
40
+			return neon()->response->sendFile(dirname(__DIR__).'/assets/placeholder.jpg', 'No File', ['inline' => true]);
41 41
 		}
42 42
 
43 43
 		// as the url is unique for a file we can be aggressive about caching
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			return $firefly->fileManager->sendFile($id, (bool) $download);
56 56
 		} catch (\Exception $e) {
57 57
 			// if path unknown respond with a blank placeholder
58
-			return neon()->response->sendFile(dirname(__DIR__) . '/assets/placeholder.jpg', 'No File', ['inline' => true]);
58
+			return neon()->response->sendFile(dirname(__DIR__).'/assets/placeholder.jpg', 'No File', ['inline' => true]);
59 59
 		}
60 60
 	}
61 61
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		$id = neon()->request->getRequired('id');
82 82
 
83 83
 		// create a unique request key - add v2 to force use of new cached version
84
-		$requestKey = neon()->request->absoluteUrl . 'v10';
84
+		$requestKey = neon()->request->absoluteUrl.'v10';
85 85
 
86 86
 		// see if we already have this in cache and the browser already has it too
87 87
 		// We want to remove the need to process images when ever possible
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function generatePublicFile($id, $imageContent)
134 134
 	{
135
-		$dir = substr($id,0, 3);
135
+		$dir = substr($id, 0, 3);
136 136
 		$publicDir = neon()->getAlias("@webroot/assets/firefly/$dir");
137 137
 		if (!file_exists($publicDir)) {
138 138
 			FileHelper::createDirectory($publicDir);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * Handle a request that can return a 304 not modified header
168 168
 	 * @param bool|string $cacheKey - default false - if cache key is specified
169 169
 	 */
170
-	public function handleNotModified($cacheKey=false)
170
+	public function handleNotModified($cacheKey = false)
171 171
 	{
172 172
 		$requestHeaders = neon()->request->headers;
173 173
 		$browserHasCache = (isset($requestHeaders['If-Modified-Since']) || isset($requestHeaders['If-None-Match']));
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	{
184 184
 		header($_SERVER['SERVER_PROTOCOL'].' 304 Not modified');
185 185
 		header('Cache-Control: private, max-age=30000000, immutable, only-if-cached');
186
-		header('Expires: ' . Carbon::now()->addYear(10)->toRfc1123String());
186
+		header('Expires: '.Carbon::now()->addYear(10)->toRfc1123String());
187 187
 		exit;
188 188
 	}
189 189
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
 		// set expiry information on the file
48 48
 		$meta = $firefly->fileManager->getMeta($id);
49
-		if ($meta['mime_type'] == 'image/svg')
50
-			$meta['mime_type'] = 'image/svg+xml';
49
+		if ($meta['mime_type'] == 'image/svg') {
50
+					$meta['mime_type'] = 'image/svg+xml';
51
+		}
51 52
 		$this->sendCacheHeaders($meta['mime_type'], $meta['size'], $meta['updated_at'], md5($request->absoluteUrl), $meta['name']);
52 53
 		$download = $request->get('download', $request->get('dl', false));
53 54
 		try {
@@ -110,7 +111,9 @@  discard block
 block discarded – undo
110 111
 			$processedImage = neon()->firefly->imageManager->process($idOrUrl, neon()->request->get());
111 112
 			$mimeType = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $processedImage);
112 113
 			// svgs don't seem display in browsers without specifically the svg+xml mime type
113
-			if ($mimeType === 'image/svg') $mimeType = 'image/svg+xml';
114
+			if ($mimeType === 'image/svg') {
115
+				$mimeType = 'image/svg+xml';
116
+			}
114 117
 			return [
115 118
 				// recalculate the mime type in case was spoofed
116 119
 				'size' => strlen($processedImage),
Please login to merge, or discard this patch.
neon/cms/controllers/RenderController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * slug it uses - without this property the canonical function will return the url of the first blog-post
83 83
 	 * (collection page) it finds.
84 84
 	 */
85
-	public function actionPage($nice_id, $slug='')
85
+	public function actionPage($nice_id, $slug = '')
86 86
 	{
87 87
 		\Neon::beginProfile('COBE::RENDER_ACTION', 'cobe');
88 88
 		$cms = $this->getCms();
89 89
 		$page = $cms->getPage();
90 90
 		// check the page with the nice_id exists
91
-		if (! $page->setById($nice_id)) {
91
+		if (!$page->setById($nice_id)) {
92 92
 			$this->pageNotFound();
93 93
 		}
94 94
 		//return neon()->view->injectHtml('');
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		}
104 104
 
105 105
 		// Don't display draft pages unless in edit mode.
106
-		if ($page->isStatusDraft() && ! $page->isInEditMode()) {
106
+		if ($page->isStatusDraft() && !$page->isInEditMode()) {
107 107
 			$this->pageNotFound();
108 108
 		}
109 109
 
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 			->innerJoin(CmsPage::tableName(), 'cms_page.nice_id = cms_url.nice_id')
136 136
 			->where("status='PUBLISHED'")
137 137
 			->all()
138
-		)->reduce(function($carry, $url){
139
-			return $carry . "\t<url>\n\t\t<loc>" . url($url['url'], true) . "</loc>\n\t</url>" . "\n";
138
+		)->reduce(function($carry, $url) {
139
+			return $carry."\t<url>\n\t\t<loc>".url($url['url'], true)."</loc>\n\t</url>"."\n";
140 140
 		});
141 141
 		header('Content-Type:application/rss+xml');
142 142
 		echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
 		}
109 109
 
110 110
 		$render = $page->render();
111
-		if ($render === false)
112
-			throw new \yii\web\HttpException(404, 'No template found');
111
+		if ($render === false) {
112
+					throw new \yii\web\HttpException(404, 'No template found');
113
+		}
113 114
 
114 115
 		\Neon::endProfile('COBE::RENDER_ACTION', 'cobe');
115 116
 
@@ -153,10 +154,12 @@  discard block
 block discarded – undo
153 154
 	{
154 155
 		$request = neon()->request;
155 156
 		$url = $request->get('page');
156
-		if (!$url)
157
-			$this->pageNotFound();
158
-		if (($urlEntry = CmsUrl::findByUrl($url)))
159
-			return $this->actionPage($urlEntry['nice_id']);
157
+		if (!$url) {
158
+					$this->pageNotFound();
159
+		}
160
+		if (($urlEntry = CmsUrl::findByUrl($url))) {
161
+					return $this->actionPage($urlEntry['nice_id']);
162
+		}
160 163
 		$this->pageNotFound();
161 164
 	}
162 165
 
Please login to merge, or discard this patch.
neon/core/web/UrlManager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 		if (strpos($url, '://') === false) {
29 29
 			$hostInfo = setting('cms', 'canonical', $urlManager->getHostInfo());
30 30
 			if (strncmp($url, '//', 2) === 0) {
31
-				$url = substr($hostInfo, 0, strpos($hostInfo, '://')) . ':' . $url;
31
+				$url = substr($hostInfo, 0, strpos($hostInfo, '://')).':'.$url;
32 32
 			} else {
33
-				$url = $hostInfo . $url;
33
+				$url = $hostInfo.$url;
34 34
 			}
35 35
 		}
36 36
 		return Url::ensureScheme($url, null);
Please login to merge, or discard this patch.
neon/core/view/SmartySharedPlugins.php 2 patches
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,7 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function googleCode($params)
127 127
 	{
128 128
 		$id = setting('cms', 'google_code');
129
-		if (empty($id)) return '';
129
+		if (empty($id)) {
130
+			return '';
131
+		}
130 132
 		// if using google tag manager
131 133
 		if (substr($id, 0, 3) === 'GTM') {
132 134
 			$head = <<<HEADJS
@@ -923,7 +925,4 @@  discard block
 block discarded – undo
923 925
 		if (!empty($params['assign'])) {
924 926
 			$smarty->assign($params['assign'], $output);
925 927
 		} else {
926
-			return $output;
927
-		}
928
-	}
929
-}
928
+			return $output
930 929
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 
539 539
 		$html = [];
540 540
 		$params['loading'] = Arr::get($params, 'loading', 'lazy');
541
-		$params[Arr::get($params, 'srcset-name', 'srcset')] = Arr::get($params, 'srcset', $this->image_srcset(['src' => $id, 'quality'=> $quality, 'widths'=>$widths]));
542
-		$params[Arr::get($params, 'src-name', 'src')] = $this->firefly_image(['id' => $id, 'w' => (int)$srcWidth, 'q' => $quality]);
541
+		$params[Arr::get($params,  'srcset-name', 'srcset')] = Arr::get($params, 'srcset', $this->image_srcset(['src' => $id, 'quality'=> $quality, 'widths'=>$widths]));
542
+		$params[Arr::get($params,  'src-name', 'src')] = $this->firefly_image(['id' => $id, 'w' => (int)$srcWidth, 'q' => $quality]);
543 543
 
544 544
 		// alt
545 545
 		$params['alt'] = Arr::get($params, 'alt', $this->image_alt(['src' => $id]));
@@ -897,7 +897,4 @@  discard block
 block discarded – undo
897 897
 		if (!empty($params['assign'])) {
898 898
 			$smarty->assign($params['assign'], $output);
899 899
 		} else {
900
-			return $output;
901
-		}
902
-	}
903
-}
900
+			return $output
904 901
\ No newline at end of file
Please login to merge, or discard this patch.
neon/cms/components/CmsUrlRule.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@
 block discarded – undo
30 30
 	 */
31 31
 	public function parseRequest($manager, $request)
32 32
 	{
33
-		$pathInfo = '/' . $request->getPathInfo();
33
+		$pathInfo = '/'.$request->getPathInfo();
34 34
 		$url = CmsUrl::find()->where(['url' => $pathInfo])->limit(1)->one();
35 35
 		// if the url is not in the url table then return false to continue processing other route rules
36 36
 		// typically in a neon setup the module/controller/action rule
37
-		if (! $url) return false;
37
+		if (!$url) return false;
38 38
 		// check if the url found represents a redirect
39 39
 		if ($url['redirect'] !== null) {
40 40
 			neon()->response->redirect($url['redirect'], 301)->send();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
 		$url = CmsUrl::find()->where(['url' => $pathInfo])->limit(1)->one();
35 35
 		// if the url is not in the url table then return false to continue processing other route rules
36 36
 		// typically in a neon setup the module/controller/action rule
37
-		if (! $url) return false;
37
+		if (! $url) {
38
+			return false;
39
+		}
38 40
 		// check if the url found represents a redirect
39 41
 		if ($url['redirect'] !== null) {
40 42
 			neon()->response->redirect($url['redirect'], 301)->send();
Please login to merge, or discard this patch.