Passed
Push — develop ( 7bdbd7...e398eb )
by Neill
33:33 queued 15s
created
neon/core/view/SmartySharedPlugins.php 1 patch
Braces   +35 added lines, -25 removed lines patch added patch discarded remove patch
@@ -148,8 +148,9 @@  discard block
 block discarded – undo
148 148
 			if (class_exists($class)) {
149 149
 				$widget = new $class();
150 150
 				foreach($params as $key => $val) {
151
-					if ($widget->hasProperty($key))
152
-						$widget->$key = $val;
151
+					if ($widget->hasProperty($key)) {
152
+											$widget->$key = $val;
153
+					}
153 154
 				}
154 155
 				return $widget->run();
155 156
 			} else {
@@ -176,8 +177,9 @@  discard block
 block discarded – undo
176 177
 		$name = Arr::getRequired($params, 'name');
177 178
 		$type = Arr::getRequired($params, 'type');
178 179
 		$options = Arr::get($params, 'options', []);
179
-		if (!is_array($options))
180
-			throw new \InvalidArgumentException('"options" property must be an array "' . gettype($options) . '" given');
180
+		if (!is_array($options)) {
181
+					throw new \InvalidArgumentException('"options" property must be an array "' . gettype($options) . '" given');
182
+		}
181 183
 		$default = Arr::get($params, 'default', '');
182 184
 
183 185
 		$value = neon()->view->styleManager->add($name, $default, $type, $options);
@@ -259,8 +261,9 @@  discard block
 block discarded – undo
259 261
 	 */
260 262
 	public function firefly_url($params)
261 263
 	{
262
-		if (isset($params['id']))
263
-			return neon()->firefly->getUrl($params['id']);
264
+		if (isset($params['id'])) {
265
+					return neon()->firefly->getUrl($params['id']);
266
+		}
264 267
 	}
265 268
 
266 269
 	/**
@@ -285,8 +288,9 @@  discard block
 block discarded – undo
285 288
 	 */
286 289
 	public function firefly_image($params)
287 290
 	{
288
-		if (isset($params['id']))
289
-			return neon()->firefly->getImage(Arr::pull($params, 'id'), $params);
291
+		if (isset($params['id'])) {
292
+					return neon()->firefly->getImage(Arr::pull($params, 'id'), $params);
293
+		}
290 294
 	}
291 295
 
292 296
 	/**
@@ -352,8 +356,7 @@  discard block
 block discarded – undo
352 356
 				}
353 357
 				$srcSizeParts[]=$break;
354 358
 			}
355
-		}
356
-		elseif (isset($params['resolutions'])) {
359
+		} elseif (isset($params['resolutions'])) {
357 360
 			// optionally validate & collate any specified resolutions to use (if breaks haven't been specified)
358 361
 			$useResolutions = array_map('trim',explode(',',Arr::pull($params,'resolutions')));
359 362
 			if (count($useResolutions) != count($widths)-1) {
@@ -364,8 +367,7 @@  discard block
 block discarded – undo
364 367
 					throw new \InvalidArgumentException("The resolution '".$useResolution."' is not a valid resolution, it should be numeric and then end with an 'x'");
365 368
 				}
366 369
 			}
367
-		}
368
-		else {
370
+		} else {
369 371
 			// if neither 'breaks' or 'resolutions' was specified then use the widths
370 372
 			foreach ($widths as $idx=>$width) {
371 373
 				if ($idx==0 && $minBreak) {
@@ -394,8 +396,7 @@  discard block
 block discarded – undo
394 396
 			$imageUrl = $this->firefly_image($useParams);
395 397
 			if ($useResolutions) {
396 398
 				$srcsetParts[] = $imageUrl.( ($idx>=1) ? ' '.$useResolutions[$idx-1] : '' );
397
-			}
398
-			else {
399
+			} else {
399 400
 				$srcsetParts[] = $imageUrl . ' ' . $width . 'w';
400 401
 			}
401 402
 			if ($idx==0 && !isset($params['src-width']) && !isset($params['src'])) {
@@ -456,10 +457,11 @@  discard block
 block discarded – undo
456 457
 		$assign = isset($params['assign']) ? $params['assign'] : null;
457 458
 		if ($app && $name) {
458 459
 			$value = neon('settings')->manager->get($app, $name, $default);
459
-			if ($assign)
460
-				$smarty->assign($assign, $value);
461
-			else
462
-				return $value;
460
+			if ($assign) {
461
+							$smarty->assign($assign, $value);
462
+			} else {
463
+							return $value;
464
+			}
463 465
 		} else {
464 466
 			return "Usage: you must provide an 'app' and a 'name' parameter. You provided ".print_r($params,true);
465 467
 		}
@@ -482,8 +484,9 @@  discard block
 block discarded – undo
482 484
 	public function time($params)
483 485
 	{
484 486
 		$format = 'Y-m-d H:i:s';
485
-		if (isset($params['stamp']))
486
-			return date($format, (integer)$params['stamp']);
487
+		if (isset($params['stamp'])) {
488
+					return date($format, (integer)$params['stamp']);
489
+		}
487 490
 		return date($format);
488 491
 	}
489 492
 
@@ -555,7 +558,9 @@  discard block
 block discarded – undo
555 558
 	 */
556 559
 	public function js($params, $content)
557 560
 	{
558
-		if ($content == null) return;
561
+		if ($content == null) {
562
+			return;
563
+		}
559 564
 		$key = Arr::get($params, 'key', null);
560 565
 		$content = str_replace(['<script>', '</script>'], '', $content);
561 566
 		neon()->view->registerJs($content, $this->getAssetPosition($params), $key);
@@ -578,7 +583,9 @@  discard block
 block discarded – undo
578 583
 	 */
579 584
 	public function css($params, $content)
580 585
 	{
581
-		if ($content == null) return;
586
+		if ($content == null) {
587
+			return;
588
+		}
582 589
 		$key = Arr::get($params, 'key', null);
583 590
 		$content = str_replace(['<style>', '</style>'], '', $content);
584 591
 		neon()->view->registerCss($content, ['position'=>$this->getAssetPosition($params, 'head')], $key);
@@ -605,7 +612,9 @@  discard block
 block discarded – undo
605 612
 	{
606 613
 		// get the bundle - will look for `name` or `bundle` or `path` keys
607 614
 		$class = Arr::get($params, 'name', Arr::get($params, 'path', null));
608
-		if ($class == null) return;
615
+		if ($class == null) {
616
+			return;
617
+		}
609 618
 
610 619
 		// get the position - will looks for `pos` or `position` keys - defaults View::POS_END
611 620
 		$position = Arr::get($params, 'pos', Arr::get($params, 'position', 'end'));
@@ -703,8 +712,9 @@  discard block
 block discarded – undo
703 712
 	 */
704 713
 	public function hasPermission($params, $smarty)
705 714
 	{
706
-		if (empty($params['permission']))
707
-			trigger_error("permission: missing 'permission' parameter");
715
+		if (empty($params['permission'])) {
716
+					trigger_error("permission: missing 'permission' parameter");
717
+		}
708 718
 		$permission = $params['permission'];
709 719
 		$assign = empty($params['assign']) ? $permission : $params['assign'];
710 720
 		$canDo = neon()->user->can($permission, $params);
Please login to merge, or discard this patch.
neon/core/ApplicationTrait.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -413,8 +413,9 @@  discard block
 block discarded – undo
413 413
 		$this->setModule($name, $config);
414 414
 
415 415
 		// set up any alternatives for this
416
-		if (isset($config['appAliases']))
417
-			$this->setModuleAliases($name, $config['appAliases']);
416
+		if (isset($config['appAliases'])) {
417
+					$this->setModuleAliases($name, $config['appAliases']);
418
+		}
418 419
 	}
419 420
 
420 421
 	/**
@@ -468,8 +469,9 @@  discard block
 block discarded – undo
468 469
 		foreach($apps as $app => $config) {
469 470
 			$appObject = $this->getApp($app);
470 471
 			// apps that are disabled will return null
471
-			if ($appObject !== null)
472
-				$ret[$app] = $this->getApp($app);
472
+			if ($appObject !== null) {
473
+							$ret[$app] = $this->getApp($app);
474
+			}
473 475
 		}
474 476
 		return $ret;
475 477
 	}
@@ -485,8 +487,9 @@  discard block
 block discarded – undo
485 487
 	public function orderAppsByRequired($apps, &$ordered = null, &$read = null)
486 488
 	{
487 489
 		static $initialApps = null;
488
-		if ($ordered == null)
489
-			$initialApps = $apps;
490
+		if ($ordered == null) {
491
+					$initialApps = $apps;
492
+		}
490 493
 		$ordered = $ordered == null ? [] : $ordered;
491 494
 		$read = $read == null ? [] : $read;
492 495
 		foreach ($apps as $key=>$app) {
@@ -497,15 +500,17 @@  discard block
 block discarded – undo
497 500
 				foreach ($requires as $r) {
498 501
 					$r = trim($r);
499 502
 					// prevent circular references breaking the system
500
-					if (!array_key_exists($r, $read))
501
-						$required[$r] = $initialApps[$r];
503
+					if (!array_key_exists($r, $read)) {
504
+											$required[$r] = $initialApps[$r];
505
+					}
502 506
 				}
503 507
 				if (count($required)) {
504 508
 					$this->orderAppsByRequired($required, $ordered, $read);
505 509
 				}
506 510
 			}
507
-			if (!array_key_exists($key, $ordered))
508
-				$ordered[$key] = $app;
511
+			if (!array_key_exists($key, $ordered)) {
512
+							$ordered[$key] = $app;
513
+			}
509 514
 		}
510 515
 	}
511 516
 
@@ -677,8 +682,9 @@  discard block
 block discarded – undo
677 682
 	 */
678 683
 	private function setModuleAliases($name, $aliases)
679 684
 	{
680
-		foreach($aliases as $alias)
681
-			static::$_moduleAliases[$alias] = $name;
685
+		foreach($aliases as $alias) {
686
+					static::$_moduleAliases[$alias] = $name;
687
+		}
682 688
 	}
683 689
 
684 690
 	/**
Please login to merge, or discard this patch.
neon/core/web/Request.php 1 patch
Braces   +18 added lines, -10 removed lines patch added patch discarded remove patch
@@ -151,10 +151,12 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function get($name = null, $defaultValue = null)
153 153
 	{
154
-		if ($this->_sanitisedQueryParams == null)
155
-			$this->sanitiseBodyQueryParams();
156
-		if ($name == null)
157
-			return $this->_sanitisedQueryParams;
154
+		if ($this->_sanitisedQueryParams == null) {
155
+					$this->sanitiseBodyQueryParams();
156
+		}
157
+		if ($name == null) {
158
+					return $this->_sanitisedQueryParams;
159
+		}
158 160
 		return isset($this->_sanitisedQueryParams[$name]) ? $this->_sanitisedQueryParams[$name] : $defaultValue;
159 161
 	}
160 162
 
@@ -167,10 +169,12 @@  discard block
 block discarded – undo
167 169
 	 */
168 170
 	public function post($name = null, $defaultValue = null)
169 171
 	{
170
-		if ($this->_sanitisedBodyParams == null)
171
-			$this->sanitiseBodyQueryParams();
172
-		if ($name == null)
173
-			return $this->_sanitisedBodyParams;
172
+		if ($this->_sanitisedBodyParams == null) {
173
+					$this->sanitiseBodyQueryParams();
174
+		}
175
+		if ($name == null) {
176
+					return $this->_sanitisedBodyParams;
177
+		}
174 178
 		return isset($this->_sanitisedBodyParams[$name]) ? $this->_sanitisedBodyParams[$name] : $defaultValue;
175 179
 	}
176 180
 
@@ -304,10 +308,14 @@  discard block
 block discarded – undo
304 308
 		$route = neon()->controller->getRoute();
305 309
 		$match = Str::is(ltrim($pattern, '/'), $route);
306 310
 		// we can return imidiately if the route does not match the pattern
307
-		if (!$match) return false;
311
+		if (!$match) {
312
+			return false;
313
+		}
308 314
 
309 315
 		// if no param search specified then return the match
310
-		if (empty($params)) return $match;
316
+		if (empty($params)) {
317
+			return $match;
318
+		}
311 319
 
312 320
 		// Finally check if $params exist in request params
313 321
 		return Arr::isSubset($params, neon()->request->getQueryParams());
Please login to merge, or discard this patch.
neon/core/web/StyleManager.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,9 @@
 block discarded – undo
72 72
 		// check if a style property already exists
73 73
 		$styleValue = $this->getStyleValue($name, $default);
74 74
 		$options['name'] = $name;
75
-		if (!isset($options['class']))
76
-			$options['class'] = $type;
75
+		if (!isset($options['class'])) {
76
+					$options['class'] = $type;
77
+		}
77 78
 		$options['label'] = Arr::get($options, 'label', Str::humanize($name));
78 79
 		$this->set($name, $styleValue, $options);
79 80
 		return $styleValue;
Please login to merge, or discard this patch.
neon/core/web/View.php 1 patch
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -189,8 +189,9 @@  discard block
 block discarded – undo
189 189
 	public function renderHeadHtml()
190 190
 	{
191 191
 		profile_begin('renderHeadHtml');
192
-		if ($this->cssConcatenate)
193
-			$this->cssFiles = $this->resolveFiles($this->cssFiles, 'css');
192
+		if ($this->cssConcatenate) {
193
+					$this->cssFiles = $this->resolveFiles($this->cssFiles, 'css');
194
+		}
194 195
 		$out = parent::renderHeadHtml() . "\n" . $this->getHtmlFragment(self::POS_HEAD);
195 196
 		profile_end('renderHeadHtml');
196 197
 		return $out;
@@ -211,8 +212,9 @@  discard block
 block discarded – undo
211 212
 	{
212 213
 		profile_begin('renderBodyEndHtml');
213 214
 		if ($this->jsConcatenate) {
214
-			if (isset($this->jsFiles[self::POS_END]))
215
-				$this->jsFiles[self::POS_END] = $this->resolveFiles($this->jsFiles[self::POS_END], 'js');
215
+			if (isset($this->jsFiles[self::POS_END])) {
216
+							$this->jsFiles[self::POS_END] = $this->resolveFiles($this->jsFiles[self::POS_END], 'js');
217
+			}
216 218
 		}
217 219
 		$out = parent::renderBodyEndHtml($ajaxMode) . "\n" . $this->getHtmlFragment(self::POS_END);
218 220
 		profile_end('renderBodyEndHtml');
@@ -260,7 +262,9 @@  discard block
 block discarded – undo
260 262
 		$concatFiles = $this->findFilesToConcatenate($files);
261 263
 		$url = ($type === 'css') ? $this->cssConcatenateFiles($concatFiles) : $this->jsConcatenateFiles($concatFiles);
262 264
 		// replace css/js files to be output with the one concatenated file
263
-		foreach($concatFiles as $fileKey) unset($files[$fileKey]);
265
+		foreach($concatFiles as $fileKey) {
266
+			unset($files[$fileKey]);
267
+		}
264 268
 		$files[$url] = ($type === 'css') ? Html::cssFile($url) : Html::jsFile($url);
265 269
 		return $files;
266 270
 	}
@@ -359,11 +363,13 @@  discard block
 block discarded – undo
359 363
 		$concatenateFiles = [];
360 364
 		foreach ($files as $fileKey => $tag) {
361 365
 			// Do not concatenate externally loaded files (for e.g. from cdns)
362
-			if (Url::isAbsolute($fileKey))
363
-				continue;
366
+			if (Url::isAbsolute($fileKey)) {
367
+							continue;
368
+			}
364 369
 			// remove excluded files - files we do not want to concatenate
365
-			if (Str::contains($tag, 'concatenate="false"'))
366
-				continue;
370
+			if (Str::contains($tag, 'concatenate="false"')) {
371
+							continue;
372
+			}
367 373
 			$concatenateFiles[] = $fileKey;
368 374
 		}
369 375
 		profile_end('_findFilesToConcatenate');
@@ -383,8 +389,9 @@  discard block
 block discarded – undo
383 389
 	private function _assetManagerGenerate($path, $callback)
384 390
 	{
385 391
 		$file = neon()->getAlias(neon()->assetManager->basePath . $path);
386
-		if (! file_exists($file))
387
-			File::createFile($file, $callback());
392
+		if (! file_exists($file)) {
393
+					File::createFile($file, $callback());
394
+		}
388 395
 		return neon()->assetManager->baseUrl . $path;
389 396
 	}
390 397
 
@@ -407,8 +414,9 @@  discard block
 block discarded – undo
407 414
 			$this->renderFile($file, $this->getStyleData($styleKey))
408 415
 			: file_get_contents(neon()->getAlias($file));
409 416
 		// minify css file
410
-		if (neon()->view->cssMinify)
411
-			$css = Css::minify($css);
417
+		if (neon()->view->cssMinify) {
418
+					$css = Css::minify($css);
419
+		}
412 420
 		return $css;
413 421
 	}
414 422
 
Please login to merge, or discard this patch.
neon/core/controllers/GridController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
 			unset($rows);
30 30
 		} while ($hasRows === true);
31 31
 		$handle = fopen($csvFile, 'r');
32
-		if ($handle)
33
-			neon()->response->sendStreamAsFile($handle, $grid->title.'.csv')->send();
32
+		if ($handle) {
33
+					neon()->response->sendStreamAsFile($handle, $grid->title.'.csv')->send();
34
+		}
34 35
 		@unlink($csvFile);
35 36
 	}
36 37
 
Please login to merge, or discard this patch.
neon/core/helpers.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,10 +31,11 @@  discard block
 block discarded – undo
31 31
 	{
32 32
 		echo dp_string(...$dump);
33 33
 		$backtrace = backtrace_line_by_function('dp');
34
-		if (neon()->debug)
35
-			echo $backtrace;
36
-		else
37
-			\Neon::error($backtrace);
34
+		if (neon()->debug) {
35
+					echo $backtrace;
36
+		} else {
37
+					\Neon::error($backtrace);
38
+		}
38 39
 	}
39 40
 }
40 41
 
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 			$str .= "<pre>$debug</pre>";
86 87
 		}
87 88
 
88
-		if (neon()->debug)
89
-			return $str;
89
+		if (neon()->debug) {
90
+					return $str;
91
+		}
90 92
 		\Neon::error($str);
91 93
 		return '';
92 94
 	}
@@ -124,8 +126,9 @@  discard block
 block discarded – undo
124 126
 	function debug_message(...$dump)
125 127
 	{
126 128
 		// security feature to ensure debug is not displayed unless in debug mode
127
-		if (!neon()->debug)
128
-			return '';
129
+		if (!neon()->debug) {
130
+					return '';
131
+		}
129 132
 		return dp_string(...$dump);
130 133
 	}
131 134
 }
@@ -242,8 +245,9 @@  discard block
 block discarded – undo
242 245
 	 */
243 246
 	function truthy($value)
244 247
 	{
245
-		if ($value && strtolower($value) !== "false")
246
-			return true;
248
+		if ($value && strtolower($value) !== "false") {
249
+					return true;
250
+		}
247 251
 		return false;
248 252
 	}
249 253
 }
@@ -450,8 +454,9 @@  discard block
 block discarded – undo
450 454
 	function faker()
451 455
 	{
452 456
 		static $faker = null;
453
-		if ($faker === null)
454
-			$faker = \Faker\Factory::create();
457
+		if ($faker === null) {
458
+					$faker = \Faker\Factory::create();
459
+		}
455 460
 		return $faker;
456 461
 	}
457 462
 }
Please login to merge, or discard this patch.
neon/core/test/Unit.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@
 block discarded – undo
38 38
 		$source = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
39 39
 		$sourceLen = strlen($source);
40 40
 		$string = '';
41
-		for ($i=0; $i<$size; $i++)
42
-			$string .= substr($source, rand(0, $sourceLen-1), 1);
41
+		for ($i=0; $i<$size; $i++) {
42
+					$string .= substr($source, rand(0, $sourceLen-1), 1);
43
+		}
43 44
 		return $string;
44 45
 	}
45 46
 
Please login to merge, or discard this patch.
neon/core/BaseApp.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,8 +106,9 @@
 block discarded – undo
106 106
 	public function getMenu()
107 107
 	{
108 108
 		// if the menu has been overridden
109
-		if ($this->_menu !== null)
110
-			return $this->_menu;
109
+		if ($this->_menu !== null) {
110
+					return $this->_menu;
111
+		}
111 112
 		return $this->getDefaultMenu();
112 113
 	}
113 114
 
Please login to merge, or discard this patch.