Passed
Push — develop ( 7bdbd7...e398eb )
by Neill
33:33 queued 15s
created
neon/core/form/FormRepeater.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		if (!is_array($value))
106 106
 			throw new \InvalidArgumentException('The value should be an array');
107 107
 
108
-		foreach($value as $position => $values) {
108
+		foreach ($value as $position => $values) {
109 109
 			if (!$this->hasField($position)) {
110 110
 				$this->addInstance($position);
111 111
 			}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	{
121 121
 		$subFormCount = count(parent::getSubForms());
122 122
 		if ($subFormCount < $this->count) {
123
-			for ($i = $subFormCount; $i <= $this->count-1; $i++) {
123
+			for ($i = $subFormCount; $i <= $this->count - 1; $i++) {
124 124
 				$this->addInstance($i);
125 125
 			}
126 126
 		}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * The fields in the template must register their scripts
132 132
 	 * @param null $view
133 133
 	 */
134
-	public function registerScripts($view=null, $mount=true)
134
+	public function registerScripts($view = null, $mount = true)
135 135
 	{
136 136
 		$view = ($view === null) ? $this->getView() : $view;
137 137
 		foreach ($this->getTemplate()->getFields() as $field)
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 * Get fields - also add additional instances as appropriate
210 210
 	 * @inheritdoc
211 211
 	 */
212
-	public function getFields($names=null)
212
+	public function getFields($names = null)
213 213
 	{
214 214
 		$subFormCount = count(parent::getSubForms());
215 215
 		if ($subFormCount < $this->count) {
216
-			for ($i = $subFormCount; $i <= $this->count-1; $i++) {
216
+			for ($i = $subFormCount; $i <= $this->count - 1; $i++) {
217 217
 				$this->addInstance(Hash::uuid64());
218 218
 			}
219 219
 		}
Please login to merge, or discard this patch.
neon/core/view/MarkdownNeon.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		$block = ['neonPlugin'];
73 73
 
74 74
 		$block['plugin']  = $this->_getPluginNameFromLines($lines, $current);
75
-		$block['attributes']  = $this->_getPluginAttributesFromLines($lines, $current);
75
+		$block['attributes'] = $this->_getPluginAttributesFromLines($lines, $current);
76 76
 		$block['content'] = $this->_getPluginContentFromLines($lines, $current, $endLine);
77 77
 
78 78
 		return [$block, $endLine];
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	protected function renderNeonPlugin($block)
82 82
 	{
83 83
 		$plugin = $block['plugin'];
84
-		$content = implode("\n",$block['content']);
84
+		$content = implode("\n", $block['content']);
85 85
 		$attributes = $block['attributes'];
86 86
 		if (class_exists($plugin))
87 87
 			return $plugin::widget(array_merge($attributes, ['content' => $content]));
88
-		return '<div class="alert alert-danger">unknown plugin: &quot;' .  $plugin . '&quot;</div>';
88
+		return '<div class="alert alert-danger">unknown plugin: &quot;'.$plugin.'&quot;</div>';
89 89
 	}
90 90
 
91 91
 	protected function _getPluginAttributesFromLines($lines, $current)
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		}
106 106
 		// remove tag and open delimiter from first and last lines
107 107
 		$plugin = $this->_getPluginNameFromLines($lines, $current);
108
-		$lastLine = \count($content)-1;
108
+		$lastLine = \count($content) - 1;
109 109
 		$content[0] = Str::replaceFirst($openDelimiter, '', $content[0]);
110 110
 		$content[0] = Str::replaceFirst($plugin, '', $content[0]);
111 111
 		$content[$lastLine] = Str::replaceLast($closeDelimiter, '', $content[$lastLine]);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		// xml part
115 115
 		$xml = simplexml_load_string("<attr $attrs></attr>");
116 116
 		$attributes = [];
117
-		foreach($xml[0]->attributes() as $a => $b) {
117
+		foreach ($xml[0]->attributes() as $a => $b) {
118 118
 			$attributes[$a] = (string) $b;
119 119
 		}
120 120
 		return $attributes;
Please login to merge, or discard this patch.
neon/core/view/SmartyExtension.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			trigger_error("path: missing 'route' parameter");
73 73
 		}
74 74
 
75
-		array_unshift($params, $params['route']) ;
75
+		array_unshift($params, $params['route']);
76 76
 		unset($params['route']);
77 77
 
78 78
 		return Url::to($params);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		if ($type === 'block') {
120 120
 			// Register widget tag during compile time
121 121
 			$this->viewRenderer->widgets['blocks'][$alias] = $class;
122
-			$this->smarty->registerPlugin('block', $alias, [$this->viewRenderer, '_widget_block__' . $alias]);
122
+			$this->smarty->registerPlugin('block', $alias, [$this->viewRenderer, '_widget_block__'.$alias]);
123 123
 
124 124
 			// Inject code to re-register widget tag during run-time
125 125
 			return <<<PHP
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		} elseif ($type === 'function') {
138 138
 			// Register widget tag during compile time
139 139
 			$this->viewRenderer->widgets['functions'][$alias] = $class;
140
-			$this->smarty->registerPlugin('function', $alias, [$this->viewRenderer, '_widget_function__' . $alias]);
140
+			$this->smarty->registerPlugin('function', $alias, [$this->viewRenderer, '_widget_function__'.$alias]);
141 141
 
142 142
 			// Inject code to re-register widget tag during run-time
143 143
 			return <<<PHP
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 */
284 284
 	protected function getViewConstVal($string, $default)
285 285
 	{
286
-		$val = @constant('yii\web\View::' . $string);
286
+		$val = @constant('yii\web\View::'.$string);
287 287
 		return isset($val) ? $val : $default;
288 288
 	}
289 289
 }
Please login to merge, or discard this patch.
neon/core/view/SmartySharedPlugins.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 			$params['content'] = $content;
148 148
 			if (class_exists($class)) {
149 149
 				$widget = new $class();
150
-				foreach($params as $key => $val) {
150
+				foreach ($params as $key => $val) {
151 151
 					if ($widget->hasProperty($key))
152 152
 						$widget->$key = $val;
153 153
 				}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		$type = Arr::getRequired($params, 'type');
178 178
 		$options = Arr::get($params, 'options', []);
179 179
 		if (!is_array($options))
180
-			throw new \InvalidArgumentException('"options" property must be an array "' . gettype($options) . '" given');
180
+			throw new \InvalidArgumentException('"options" property must be an array "'.gettype($options).'" given');
181 181
 		$default = Arr::get($params, 'default', '');
182 182
 
183 183
 		$value = neon()->view->styleManager->add($name, $default, $type, $options);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		if (!isset($params['route'])) {
215 215
 			trigger_error("path: missing 'route' parameter");
216 216
 		}
217
-		array_unshift($params, $params['route']) ;
217
+		array_unshift($params, $params['route']);
218 218
 		unset($params['route']);
219 219
 		return Url::toRoute($params, true);
220 220
 	}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function csrf_element($params)
234 234
 	{
235
-		return '<input type="hidden" name="'.neon()->request->csrfParam.'" value="' . neon()->request->getCsrfToken() . '" />';
235
+		return '<input type="hidden" name="'.neon()->request->csrfParam.'" value="'.neon()->request->getCsrfToken().'" />';
236 236
 	}
237 237
 
238 238
 	/**
@@ -328,39 +328,39 @@  discard block
 block discarded – undo
328 328
 			$params['widths'] = self::IMG_SRCSET_DEFAULT_WIDTHS;
329 329
 		}
330 330
 
331
-		$id = Arr::pull($params,'firefly_id');
332
-		$widths = array_map('trim',explode(',',Arr::pull($params,'widths')));
331
+		$id = Arr::pull($params, 'firefly_id');
332
+		$widths = array_map('trim', explode(',', Arr::pull($params, 'widths')));
333 333
 		$srcsetParts = [];
334 334
 		$srcSizeParts = [];
335 335
 		$useResolutions = [];
336 336
 		$minBreak = false;
337 337
 		if (isset($params['min-break'])) {
338
-			$minBreak = Arr::pull($params,'min-break');
339
-			if (!Str::validateNumericWithUnits($minBreak,['px','vw'])) {
338
+			$minBreak = Arr::pull($params, 'min-break');
339
+			if (!Str::validateNumericWithUnits($minBreak, ['px', 'vw'])) {
340 340
 				throw new \InvalidArgumentException("The min-break value '".$minBreak."' should be numeric and end with 'px' or 'vw'");
341 341
 			}
342 342
 		}
343 343
 		if (isset($params['breaks'])) {
344 344
 			// optionally validate & collate the breaks for the 'sizes' attribute
345
-			$breaks = array_map('trim',explode(',',Arr::pull($params,'breaks')));
345
+			$breaks = array_map('trim', explode(',', Arr::pull($params, 'breaks')));
346 346
 			foreach ($breaks as $idx=>$break) {
347
-				if (!Str::validateNumericWithUnits($break, ['px','vw'])) {
347
+				if (!Str::validateNumericWithUnits($break, ['px', 'vw'])) {
348 348
 					throw new \InvalidArgumentException("The break value '".$break."' should be numeric and end with 'px' or 'vw'");
349 349
 				}
350
-				if ($idx==0 && $minBreak) {
350
+				if ($idx == 0 && $minBreak) {
351 351
 					$break = "(min-width: ".$minBreak.") ".$break;
352 352
 				}
353
-				$srcSizeParts[]=$break;
353
+				$srcSizeParts[] = $break;
354 354
 			}
355 355
 		}
356 356
 		elseif (isset($params['resolutions'])) {
357 357
 			// optionally validate & collate any specified resolutions to use (if breaks haven't been specified)
358
-			$useResolutions = array_map('trim',explode(',',Arr::pull($params,'resolutions')));
359
-			if (count($useResolutions) != count($widths)-1) {
360
-				throw new \InvalidArgumentException("Since there are ".count($widths)." widths you should specify ".(count($widths)-1)." resolutions to apply");
358
+			$useResolutions = array_map('trim', explode(',', Arr::pull($params, 'resolutions')));
359
+			if (count($useResolutions) != count($widths) - 1) {
360
+				throw new \InvalidArgumentException("Since there are ".count($widths)." widths you should specify ".(count($widths) - 1)." resolutions to apply");
361 361
 			}
362 362
 			foreach ($useResolutions as $useResolution) {
363
-				if (!Str::validateNumericWithUnits($useResolution,['x'])) {
363
+				if (!Str::validateNumericWithUnits($useResolution, ['x'])) {
364 364
 					throw new \InvalidArgumentException("The resolution '".$useResolution."' is not a valid resolution, it should be numeric and then end with an 'x'");
365 365
 				}
366 366
 			}
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		else {
369 369
 			// if neither 'breaks' or 'resolutions' was specified then use the widths
370 370
 			foreach ($widths as $idx=>$width) {
371
-				if ($idx==0 && $minBreak) {
371
+				if ($idx == 0 && $minBreak) {
372 372
 					$width = "(min-width: ".$minBreak.") ".$width;
373 373
 				}
374 374
 				$srcSizeParts[] = $width."px";
@@ -387,31 +387,31 @@  discard block
 block discarded – undo
387 387
 			if (!is_numeric($width)) {
388 388
 				throw new \InvalidArgumentException("One of the widths specified was not numeric '".$width."'");
389 389
 			}
390
-			$useParams = ['id'=>$id, 'w'=>(int)$width];
390
+			$useParams = ['id'=>$id, 'w'=>(int) $width];
391 391
 			if ($useQuality) {
392 392
 				$useParams['q'] = $useQuality;
393 393
 			}
394 394
 			$imageUrl = $this->firefly_image($useParams);
395 395
 			if ($useResolutions) {
396
-				$srcsetParts[] = $imageUrl.( ($idx>=1) ? ' '.$useResolutions[$idx-1] : '' );
396
+				$srcsetParts[] = $imageUrl.(($idx >= 1) ? ' '.$useResolutions[$idx - 1] : '');
397 397
 			}
398 398
 			else {
399
-				$srcsetParts[] = $imageUrl . ' ' . $width . 'w';
399
+				$srcsetParts[] = $imageUrl.' '.$width.'w';
400 400
 			}
401
-			if ($idx==0 && !isset($params['src-width']) && !isset($params['src'])) {
401
+			if ($idx == 0 && !isset($params['src-width']) && !isset($params['src'])) {
402 402
 				$params['src'] = $imageUrl;
403 403
 			}
404 404
 		}
405 405
 
406 406
 		// collate the tag attributes
407 407
 		if (isset($params['src-width'])) {
408
-			$srcWidth = Arr::pull($params,'src-width');
408
+			$srcWidth = Arr::pull($params, 'src-width');
409 409
 			if (!is_numeric($srcWidth)) {
410 410
 				throw new \InvalidArgumentException("src-width '".$srcWidth."' must be numeric");
411 411
 			}
412
-			$useParams = ['id'=>$id, 'w'=>(int)$srcWidth];
412
+			$useParams = ['id'=>$id, 'w'=>(int) $srcWidth];
413 413
 			if (isset($params['quality'])) {
414
-				$useParams = (int)$params['quality'];
414
+				$useParams = (int) $params['quality'];
415 415
 			}
416 416
 			if (!isset($params['src'])) {
417 417
 				$params['src'] = $this->firefly_image($useParams);
@@ -425,12 +425,12 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 
427 427
 		// finally generate the tag ... note that these can overwrite the previously generated params
428
-		$tagAttributes =  [];
428
+		$tagAttributes = [];
429 429
 		foreach ($params as $key=>$value) {
430 430
 			$tagAttributes[] = $key."='".htmlspecialchars($value)."'";
431 431
 		}
432 432
 
433
-		return "<img ".implode(' ',$tagAttributes).">";
433
+		return "<img ".implode(' ', $tagAttributes).">";
434 434
 	}
435 435
 
436 436
 	/**
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			else
462 462
 				return $value;
463 463
 		} else {
464
-			return "Usage: you must provide an 'app' and a 'name' parameter. You provided ".print_r($params,true);
464
+			return "Usage: you must provide an 'app' and a 'name' parameter. You provided ".print_r($params, true);
465 465
 		}
466 466
 	}
467 467
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		$format = 'Y-m-d H:i:s';
485 485
 		if (isset($params['stamp']))
486
-			return date($format, (integer)$params['stamp']);
486
+			return date($format, (integer) $params['stamp']);
487 487
 		return date($format);
488 488
 	}
489 489
 
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 */
496 496
 	public function json($params)
497 497
 	{
498
-		return '<pre>' . json_encode($params, JSON_PRETTY_PRINT) . '</pre>';
498
+		return '<pre>'.json_encode($params, JSON_PRETTY_PRINT).'</pre>';
499 499
 	}
500 500
 
501 501
 	/**
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	 * @return int
511 511
 	 * @throws \Exception
512 512
 	 */
513
-	public function getAssetPosition($params, $default='end')
513
+	public function getAssetPosition($params, $default = 'end')
514 514
 	{
515 515
 		$position = Arr::get($params, 'pos', Arr::get($params, 'position', $default));
516 516
 		$positions = [
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 			'load'  => View::POS_LOAD,
522 522
 		];
523 523
 		if (!array_key_exists($position, $positions)) {
524
-			throw new \Exception('The javascript position specified must be one of ' . print_r(array_keys($positions)) . ', you specified "'.$position.'"');
524
+			throw new \Exception('The javascript position specified must be one of '.print_r(array_keys($positions)).', you specified "'.$position.'"');
525 525
 		}
526 526
 		return $positions[$position];
527 527
 	}
Please login to merge, or discard this patch.
neon/core/assets/JQueryUiAsset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  */
8 8
 class JQueryUiAsset extends AssetBundle
9 9
 {
10
-	public $sourcePath = __DIR__ . '/publish/vendor/jqueryui';
10
+	public $sourcePath = __DIR__.'/publish/vendor/jqueryui';
11 11
 
12 12
 	public $js = [
13 13
 		'jquery-ui.min.js'
Please login to merge, or discard this patch.
neon/core/assets/CoreAsset.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
  */
18 18
 class CoreAsset extends AssetBundle
19 19
 {
20
-	public $sourcePath = __DIR__ . '/publish';
20
+	public $sourcePath = __DIR__.'/publish';
21 21
 
22 22
 	public $js = [
23 23
 		(YII_DEBUG ? 'vendor/vue.js' : 'vendor/vue.min.js'),
Please login to merge, or discard this patch.
neon/core/ApplicationTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 */
206 206
 	public function getApps()
207 207
 	{
208
-		if ($this->_appsRequiredOrder==false) {
208
+		if ($this->_appsRequiredOrder == false) {
209 209
 			$this->orderAppsByRequired($this->_apps, $ordered);
210 210
 			$this->setApps($ordered);
211 211
 			$this->_appsRequiredOrder = true;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function getCoreApps()
242 242
 	{
243
-		if ($this->_coreAppsRequiredOrder==false) {
243
+		if ($this->_coreAppsRequiredOrder == false) {
244 244
 			$this->orderAppsByRequired($this->_coreApps, $ordered);
245 245
 			$this->setCoreApps($ordered);
246 246
 			$this->_coreAppsRequiredOrder = true;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @return array
279 279
 	 */
280
-	public static function getConfig($path, $required=true)
280
+	public static function getConfig($path, $required = true)
281 281
 	{
282 282
 		$file = Neon::getAlias($path);
283 283
 		$fileExists = file_exists($file);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			throw new \Exception('The config file alias: "'.$path.'" can not be found. File path: "'.$file.'". This config file is required.');
289 289
 		}
290 290
 		// The file does NOT exist and it is NOT required
291
-		if (!$fileExists && !$required){
291
+		if (!$fileExists && !$required) {
292 292
 			// the config is not required so we can just return an empty array
293 293
 			return [];
294 294
 		}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 */
351 351
 	public function registerApps($apps)
352 352
 	{
353
-		foreach($apps as $name => $config) {
353
+		foreach ($apps as $name => $config) {
354 354
 			$this->registerApp($name, $config);
355 355
 		}
356 356
 	}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	{
466 466
 		$apps = array_merge($this->getCoreApps(), $this->getApps());
467 467
 		$ret = [];
468
-		foreach($apps as $app => $config) {
468
+		foreach ($apps as $app => $config) {
469 469
 			$appObject = $this->getApp($app);
470 470
 			// apps that are disabled will return null
471 471
 			if ($appObject !== null)
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	public function getClassAlias()
528 528
 	{
529
-		return '@' . str_replace(['\\', 'Application'], ['/', ''], get_called_class());
529
+		return '@'.str_replace(['\\', 'Application'], ['/', ''], get_called_class());
530 530
 	}
531 531
 
532 532
 	/**
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 				$client = new \GuzzleHttp\Client();
624 624
 				$res = $client->request('GET', 'https://neon.newicon.net/api/versions/', ['connect_timeout' => 2]);
625 625
 				$versions = json_decode((string) $res->getBody());
626
-			} catch(\Exception $e) {
626
+			} catch (\Exception $e) {
627 627
 				$versions = [];
628 628
 			}
629 629
 			return $versions;
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 		$versions = $this->getNeonVersions();
641 641
 		$newerVersion = [];
642 642
 		$neonVersion = neon()->getVersion();
643
-		foreach($versions as $v) {
643
+		foreach ($versions as $v) {
644 644
 			if (version_compare($v, $neonVersion, '>')) {
645 645
 				$newerVersion[] = $v;
646 646
 			}
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 	 */
678 678
 	private function setModuleAliases($name, $aliases)
679 679
 	{
680
-		foreach($aliases as $alias)
680
+		foreach ($aliases as $alias)
681 681
 			static::$_moduleAliases[$alias] = $name;
682 682
 	}
683 683
 
Please login to merge, or discard this patch.
neon/core/web/AssetManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	 */
27 27
 	protected function hash($path)
28 28
 	{
29
-		if (isset($this->publishOptions['path'])){
29
+		if (isset($this->publishOptions['path'])) {
30 30
 			// if a path is specified then use this instead of a hash
31 31
 			return $this->publishOptions['path'];
32 32
 		}
Please login to merge, or discard this patch.
neon/core/web/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@
 block discarded – undo
299 299
 	 * used is the $pattern matches the current route
300 300
 	 * @return bool
301 301
 	 */
302
-	public function isRoute($pattern, $params=[])
302
+	public function isRoute($pattern, $params = [])
303 303
 	{
304 304
 		$route = neon()->controller->getRoute();
305 305
 		$match = Str::is(ltrim($pattern, '/'), $route);
Please login to merge, or discard this patch.