Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/core/form/fields/Uuid64.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@
 block discarded – undo
41 41
 	/**
42 42
 	 * @inheritdoc
43 43
 	 */
44
-	public function getValueDisplay($context='')
44
+	public function getValueDisplay($context = '')
45 45
 	{
46
-		return '<code>' . $this->getValue() . '</code>';
46
+		return '<code>'.$this->getValue().'</code>';
47 47
 	}
48 48
 
49 49
 	/**
Please login to merge, or discard this patch.
neon/core/form/fields/DateTime.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
 	/**
65 65
 	 * @inheritdoc
66 66
 	 */
67
-	public function getValueDisplay($context='')
67
+	public function getValueDisplay($context = '')
68 68
 	{
69 69
 		return neon()->formatter->asDatetime($this->getData());
70 70
 	}
Please login to merge, or discard this patch.
neon/core/form/fields/LocationMap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@
 block discarded – undo
88 88
 	/**
89 89
 	 * @inheritdoc
90 90
 	 */
91
-	public function getValueDisplay($context='')
91
+	public function getValueDisplay($context = '')
92 92
 	{
93 93
 
94 94
 		$value = $this->value;
Please login to merge, or discard this patch.
neon/core/form/interfaces/IField.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param string $context - specifies a rendering context for e.g. 'grid', 'summary', 'csv' etc
164 164
 	 * @return string
165 165
 	 */
166
-	public function getValueDisplay($context='');
166
+	public function getValueDisplay($context = '');
167 167
 
168 168
 	/**
169 169
 	 * Get the hint message for this field
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @param mixed $searchData - The request data if null should populate from the form fields internal $this->getValue()
237 237
 	 * @return void
238 238
 	 */
239
-	public function processAsFilter(IQuery $query, $searchData=null);
239
+	public function processAsFilter(IQuery $query, $searchData = null);
240 240
 
241 241
 // endregion
242 242
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * @param string $delimiter - the string delimiter to separate concatenated field names by
247 247
 	 * @return mixed
248 248
 	 */
249
-	public function getIdPath($delimiter='.');
249
+	public function getIdPath($delimiter = '.');
250 250
 
251 251
 	/**
252 252
 	 * Generate fake data for the field
Please login to merge, or discard this patch.
neon/core/form/Form.php 3 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 	 * @param bool $replace - will replace any existing attributes
101 101
 	 * @return $this - chainable interface
102 102
 	 */
103
-	public function setAttributes($attrs, $replace=false)
103
+	public function setAttributes($attrs, $replace = false)
104 104
 	{
105 105
 		if ($replace) {
106 106
 			$this->_attributes = $attrs;
107 107
 		} else {
108 108
 			if (isset($attrs['class'])) {
109
-				$this->_attributes['class'] = ' ' . $attrs['class'];
109
+				$this->_attributes['class'] = ' '.$attrs['class'];
110 110
 				unset($attrs['class']);
111 111
 			}
112 112
 			$this->_attributes = array_merge($this->_attributes, $attrs);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * if a string is provided then it is used as the name property
151 151
 	 * @param array $config additional configuration
152 152
 	 */
153
-	public function __construct($name=[], array $config=[])
153
+	public function __construct($name = [], array $config = [])
154 154
 	{
155 155
 		// The $name field can also be a configuration array
156 156
 		if (is_array($name)) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * @inheritdoc
203 203
 	 */
204
-	public function registerScripts($view=null, $mount=true)
204
+	public function registerScripts($view = null, $mount = true)
205 205
 	{
206 206
 		$view = ($view === null) ? $this->getView() : $view;
207 207
 		FormAsset::register($view);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			$field->registerScripts($view);
210 210
 		if ($this->isRootForm()) {
211 211
 			if ($mount)
212
-				$view->registerJs('(new Vue()).$mount("#' . $this->id . '");', $view::POS_END, $this->id . 'vue');
212
+				$view->registerJs('(new Vue()).$mount("#'.$this->id.'");', $view::POS_END, $this->id.'vue');
213 213
 		}
214 214
 	}
215 215
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	public function validate($names = null, $clearErrors = true)
260 260
 	{
261 261
 		$valid = true;
262
-		foreach($this->getFields($names) as $key => $field) {
262
+		foreach ($this->getFields($names) as $key => $field) {
263 263
 			$valid = $field->validate() && $valid;
264 264
 		}
265 265
 		// if validation has run - you will want to see it when the form is loaded
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 * @param array $errors
308 308
 	 * @return array
309 309
 	 */
310
-	protected function _getFormErrors($form, &$errors=[])
310
+	protected function _getFormErrors($form, &$errors = [])
311 311
 	{
312 312
 		foreach ($form->getFields() as $field) {
313 313
 			if ($field->isForm()) {
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	public function getErrors()
333 333
 	{
334 334
 		$errors = [];
335
-		foreach($this->getFields() as $name => $field) {
335
+		foreach ($this->getFields() as $name => $field) {
336 336
 			if ($field->hasError())
337 337
 				$errors[$name] = $field->getErrors();
338 338
 		}
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @param string $error  if this is not null then it is the error
362 362
 	 * @return void
363 363
 	 */
364
-	public function addError($fieldNameOrError='', $error=null)
364
+	public function addError($fieldNameOrError = '', $error = null)
365 365
 	{
366 366
 		if ($error === null)
367 367
 			$this->_errors[] = $fieldNameOrError;
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 */
402 402
 	public function getViewPath()
403 403
 	{
404
-		return __DIR__ . DIRECTORY_SEPARATOR . 'views';
404
+		return __DIR__.DIRECTORY_SEPARATOR.'views';
405 405
 	}
406 406
 
407 407
 	/**
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 		$i = 1;
418 418
 		while ($this->hasField($name)) {
419 419
 			if (preg_match('/.*(_[0-9]+)/', $name, $matches)) {
420
-				$name = str_replace($matches[1], '_' . $i++, $name);
420
+				$name = str_replace($matches[1], '_'.$i++, $name);
421 421
 			} else {
422
-				$name .= '_' . $i++;
422
+				$name .= '_'.$i++;
423 423
 			}
424 424
 		}
425 425
 		return $name;
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 	 * @throws InvalidCallException if a name key specified in the $names array does not exist as a field
493 493
 	 * @return \neon\core\form\fields\Field[] [name => field object]
494 494
 	 */
495
-	public function getFields($names=null)
495
+	public function getFields($names = null)
496 496
 	{
497 497
 		$this->orderFields();
498 498
 		if ($names === null)
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 	 */
526 526
 	public function getSubForm($name)
527 527
 	{
528
-		if (! $this->hasField($name)) {
528
+		if (!$this->hasField($name)) {
529 529
 			throw new \Exception("No sub form exists with the name '$name'");
530 530
 		}
531 531
 		return $this->getField($name);
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 * @throws exceptions\UnknownFieldClass - if the field class can not be created
629 629
 	 * @return fields\Field
630 630
 	 */
631
-	public function add($field, $defaults=[], $overwrite=false)
631
+	public function add($field, $defaults = [], $overwrite = false)
632 632
 	{
633 633
 		$object = $this->makeField($field, $defaults);
634 634
 		return $this->_addField($object, $overwrite);
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 	 *
642 642
 	 * @return \neon\core\form\fields\Field
643 643
 	 */
644
-	protected function _addField(IField $object, $overwrite=false)
644
+	protected function _addField(IField $object, $overwrite = false)
645 645
 	{
646 646
 		// pass the field a reference to its parent form
647 647
 		$object->setForm($this);
648 648
 		if ($object->getName() == '') {
649
-			throw new \InvalidArgumentException('A field object must have a name set before adding it to the form. You tried to add ' . print_r($object->toArray(), true));
649
+			throw new \InvalidArgumentException('A field object must have a name set before adding it to the form. You tried to add '.print_r($object->toArray(), true));
650 650
 		}
651 651
 		if ($object instanceof Field || $object instanceof Form) {
652 652
 			// the field object seems to be valid so before we add it we just check this is not a conflict with an existing field
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 			// add this form as the parent form reference
658 658
 			$this->_fields[$object->getName()] = $object;
659 659
 		} else {
660
-			throw new \InvalidArgumentException('The $object parameter was not a valid \neon\core\form\Field or \neon\core\form\Form object "' . print_r($object, true) . '" given');
660
+			throw new \InvalidArgumentException('The $object parameter was not a valid \neon\core\form\Field or \neon\core\form\Form object "'.print_r($object, true).'" given');
661 661
 		}
662 662
 		return $object;
663 663
 	}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 */
686 686
 	public function renderCsrfField()
687 687
 	{
688
-		return '<input type="hidden" name="'.$this->getRequest()->csrfParam.'" value="' . $this->getRequest()->getCsrfToken() . '" />';
688
+		return '<input type="hidden" name="'.$this->getRequest()->csrfParam.'" value="'.$this->getRequest()->getCsrfToken().'" />';
689 689
 	}
690 690
 
691 691
 	/**
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	 * @throws \yii\base\InvalidConfigException getBodyParams may throw this error if a registered parser does not implement the [[RequestParserInterface]].
758 758
 	 * @return array  the request data
759 759
 	 */
760
-	public function getRawRequestData($key=null)
760
+	public function getRawRequestData($key = null)
761 761
 	{
762 762
 		$params = $this->getRequest()->getBodyParams();
763 763
 		$data = isset($params[$this->getName()]) ? $params[$this->getName()] : [];
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	 * @throws \Exception - if request object is configured incorrectly
789 789
 	 * @return $this
790 790
 	 */
791
-	public function load($data=[])
791
+	public function load($data = [])
792 792
 	{
793 793
 		if (empty($data) && $this->hasRequestData()) {
794 794
 			$data = $this->getRawRequestData();
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 	 * Root forms always require an id
881 881
 	 * @return String
882 882
 	 */
883
-	public function getId($autoGenerate=false)
883
+	public function getId($autoGenerate = false)
884 884
 	{
885 885
 		if ($this->_id)
886 886
 			return $this->_id;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	 * @inheritdoc - IField implementation,
1002 1002
 	 * Possibly applicable to the form - perhaps if set the form will complain unless all its children are set??
1003 1003
 	 */
1004
-	public function setRequired($required=true)
1004
+	public function setRequired($required = true)
1005 1005
 	{}
1006 1006
 // endregion
1007 1007
 
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
 	public function getProperties()
1075 1075
 	{
1076 1076
 		$props = [
1077
-			'class', 'id', 'name', 'enableAjaxValidation','enableAjaxSubmission',
1077
+			'class', 'id', 'name', 'enableAjaxValidation', 'enableAjaxSubmission',
1078 1078
 			'label', 'hint', 'inline', 'visible', 'order', 'action', 'readOnly', 'printOnly', 'validationUrl',
1079 1079
 			'attributes', 'fields', 'objectToken', 'isSubmitted'
1080 1080
 		];
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 	 * Return the rendered output of the form
1099 1099
 	 * @return string
1100 1100
 	 */
1101
-	public function getValueDisplay($context='')
1101
+	public function getValueDisplay($context = '')
1102 1102
 	{
1103 1103
 		return $this->run();
1104 1104
 	}
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		foreach ($this->getFields() as $key => $field) {
1147 1147
 			$fieldDefinition = $field->exportDefinition();
1148 1148
 
1149
-			if (! is_null($field->ddsDataType) && ! is_null($fieldDefinition) )
1149
+			if (!is_null($field->ddsDataType) && !is_null($fieldDefinition))
1150 1150
 				$fields[$key] = $fieldDefinition;
1151 1151
 		}
1152 1152
 		$formDefinition['definition']['fields'] = $fields;
@@ -1211,10 +1211,10 @@  discard block
 block discarded – undo
1211 1211
 	 *
1212 1212
 	 * @return Form
1213 1213
 	 */
1214
-	public function getFilterForm($config=[])
1214
+	public function getFilterForm($config = [])
1215 1215
 	{
1216 1216
 		$searchForm = new Form($config);
1217
-		foreach($this->getFields() as $field) {
1217
+		foreach ($this->getFields() as $field) {
1218 1218
 			$filterField = $field->getFilterField();
1219 1219
 
1220 1220
 			if ($filterField !== false) {
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 	public function processAsFilter(IQuery $query, $searchData = null)
1239 1239
 	{
1240 1240
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
1241
-		foreach($this->getFields() as $key => $field) {
1241
+		foreach ($this->getFields() as $key => $field) {
1242 1242
 			if (isset($searchData[$key])) {
1243 1243
 				$field->processAsFilter($query, $searchData[$key]);
1244 1244
 			}
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 	 */
1279 1279
 	public function reset()
1280 1280
 	{
1281
-		foreach($this->getFields() as $field)
1281
+		foreach ($this->getFields() as $field)
1282 1282
 			$field->reset();
1283 1283
 	}
1284 1284
 
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
 	public function fake()
1298 1298
 	{
1299 1299
 		$fake = [];
1300
-		foreach($this->getFields() as $key => $field) {
1300
+		foreach ($this->getFields() as $key => $field) {
1301 1301
 			$val = $field->fake();
1302 1302
 			if (empty($val)) continue;
1303 1303
 			$fake[$key] = $val;
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
 	 * @deprecated should be using phoebe this should be replaced with using the loadFromDefinition via phoebe
1310 1310
 	 * @see Deprecated::ddsLoadFrom
1311 1311
 	 */
1312
-	public function ddsLoadFrom($classType, $includeDeleted=false)
1312
+	public function ddsLoadFrom($classType, $includeDeleted = false)
1313 1313
 	{
1314 1314
 		return Deprecated::ddsLoadFrom($this, $classType, $includeDeleted);
1315 1315
 	}
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
 	 * @deprecated - should be using phoebe
1319 1319
 	 * @see Deprecated::ddsSaveDefinition
1320 1320
 	 */
1321
-	public function ddsSaveDefinition($classType=null, $ddsMembers=null)
1321
+	public function ddsSaveDefinition($classType = null, $ddsMembers = null)
1322 1322
 	{
1323 1323
 		Deprecated::ddsSaveDefinition($this, $classType, $ddsMembers);
1324 1324
 	}
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -670,7 +670,7 @@
 block discarded – undo
670 670
 	/**
671 671
 	 * render the form header html
672 672
 	 * @return string
673
-    */
673
+	 */
674 674
 	public function renderHeader()
675 675
 	{
676 676
 		$options = $this->toArray();
Please login to merge, or discard this patch.
Braces   +50 added lines, -32 removed lines patch added patch discarded remove patch
@@ -205,11 +205,13 @@  discard block
 block discarded – undo
205 205
 	{
206 206
 		$view = ($view === null) ? $this->getView() : $view;
207 207
 		FormAsset::register($view);
208
-		foreach ($this->getFields() as $field)
209
-			$field->registerScripts($view);
208
+		foreach ($this->getFields() as $field) {
209
+					$field->registerScripts($view);
210
+		}
210 211
 		if ($this->isRootForm()) {
211
-			if ($mount)
212
-				$view->registerJs('(new Vue()).$mount("#' . $this->id . '");', $view::POS_END, $this->id . 'vue');
212
+			if ($mount) {
213
+							$view->registerJs('(new Vue()).$mount("#' . $this->id . '");', $view::POS_END, $this->id . 'vue');
214
+			}
213 215
 		}
214 216
 	}
215 217
 
@@ -333,8 +335,9 @@  discard block
 block discarded – undo
333 335
 	{
334 336
 		$errors = [];
335 337
 		foreach($this->getFields() as $name => $field) {
336
-			if ($field->hasError())
337
-				$errors[$name] = $field->getErrors();
338
+			if ($field->hasError()) {
339
+							$errors[$name] = $field->getErrors();
340
+			}
338 341
 		}
339 342
 		return array_merge($this->_errors, $errors);
340 343
 	}
@@ -363,10 +366,11 @@  discard block
 block discarded – undo
363 366
 	 */
364 367
 	public function addError($fieldNameOrError='', $error=null)
365 368
 	{
366
-		if ($error === null)
367
-			$this->_errors[] = $fieldNameOrError;
368
-		else
369
-			$this->getField($fieldNameOrError)->addError($error);
369
+		if ($error === null) {
370
+					$this->_errors[] = $fieldNameOrError;
371
+		} else {
372
+					$this->getField($fieldNameOrError)->addError($error);
373
+		}
370 374
 	}
371 375
 
372 376
 // ============================================================================
@@ -460,8 +464,9 @@  discard block
 block discarded – undo
460 464
 		// multiple versions of the same form can exist on a page
461 465
 		// in these scenarios the forms each can have different root form ids.
462 466
 		$bits = explode('.', $path);
463
-		if (!($bits[0] === $this->name || ($this->isRootForm() && $bits[0] === $this->id)))
464
-			throw new \Exception("The first part of the path should be the form name or the id if this is a root form. The forms name and id is: name={$this->name}, id={$this->id}. The path you used was: path=$path.");
467
+		if (!($bits[0] === $this->name || ($this->isRootForm() && $bits[0] === $this->id))) {
468
+					throw new \Exception("The first part of the path should be the form name or the id if this is a root form. The forms name and id is: name={$this->name}, id={$this->id}. The path you used was: path=$path.");
469
+		}
465 470
 		// remove first item and reindex array : note unset does not update array indexes
466 471
 		array_splice($bits, 0, 1);
467 472
 		$field = $this->getField($bits[0]);
@@ -495,8 +500,9 @@  discard block
 block discarded – undo
495 500
 	public function getFields($names=null)
496 501
 	{
497 502
 		$this->orderFields();
498
-		if ($names === null)
499
-			return $this->_fields;
503
+		if ($names === null) {
504
+					return $this->_fields;
505
+		}
500 506
 
501 507
 		return Arr::only($this->_fields, $names);
502 508
 	}
@@ -818,9 +824,12 @@  discard block
 block discarded – undo
818 824
 	{
819 825
 		$data = [];
820 826
 		foreach ($this->getFields() as $field) {
821
-			if ($field->deleted) continue;
822
-			if ($field->getIsInput())
823
-				$data[$field->getDataKey()] = $field->getData();
827
+			if ($field->deleted) {
828
+				continue;
829
+			}
830
+			if ($field->getIsInput()) {
831
+							$data[$field->getDataKey()] = $field->getData();
832
+			}
824 833
 		}
825 834
 		return $data;
826 835
 	}
@@ -834,8 +843,9 @@  discard block
 block discarded – undo
834 843
 	{
835 844
 		$data = [];
836 845
 		foreach ($this->getFields() as $field) {
837
-			if ($field->getIsInput())
838
-				$data[$field->getName()] = $field->getValueDisplay();
846
+			if ($field->getIsInput()) {
847
+							$data[$field->getName()] = $field->getValueDisplay();
848
+			}
839 849
 		}
840 850
 		return $data;
841 851
 	}
@@ -848,8 +858,9 @@  discard block
 block discarded – undo
848 858
 	 */
849 859
 	public function getDataKey()
850 860
 	{
851
-		if ($this->_dataKey !== null)
852
-			return $this->_dataKey;
861
+		if ($this->_dataKey !== null) {
862
+					return $this->_dataKey;
863
+		}
853 864
 		return $this->getName();
854 865
 	}
855 866
 
@@ -880,8 +891,9 @@  discard block
 block discarded – undo
880 891
 	 */
881 892
 	public function getId($autoGenerate=false)
882 893
 	{
883
-		if ($this->_id)
884
-			return $this->_id;
894
+		if ($this->_id) {
895
+					return $this->_id;
896
+		}
885 897
 		return $this->getName();
886 898
 	}
887 899
 
@@ -915,8 +927,9 @@  discard block
 block discarded – undo
915 927
 		$value = [];
916 928
 		foreach ($this->getFields() as $field) {
917 929
 			if (!$field->deleted) {
918
-				if ($field->getIsInput())
919
-					$value[$field->getDataKey()] = $field->getValue();
930
+				if ($field->getIsInput()) {
931
+									$value[$field->getDataKey()] = $field->getValue();
932
+				}
920 933
 			}
921 934
 		}
922 935
 		return $value;
@@ -1145,8 +1158,9 @@  discard block
 block discarded – undo
1145 1158
 		foreach ($this->getFields() as $key => $field) {
1146 1159
 			$fieldDefinition = $field->exportDefinition();
1147 1160
 
1148
-			if (! is_null($field->ddsDataType) && ! is_null($fieldDefinition) )
1149
-				$fields[$key] = $fieldDefinition;
1161
+			if (! is_null($field->ddsDataType) && ! is_null($fieldDefinition) ) {
1162
+							$fields[$key] = $fieldDefinition;
1163
+			}
1150 1164
 		}
1151 1165
 		$formDefinition['definition']['fields'] = $fields;
1152 1166
 		return $formDefinition;
@@ -1257,8 +1271,9 @@  discard block
 block discarded – undo
1257 1271
 	 */
1258 1272
 	public function getRequest()
1259 1273
 	{
1260
-		if ($this->_request === null)
1261
-			$this->_request = neon()->request;
1274
+		if ($this->_request === null) {
1275
+					$this->_request = neon()->request;
1276
+		}
1262 1277
 		return $this->_request;
1263 1278
 	}
1264 1279
 
@@ -1277,8 +1292,9 @@  discard block
 block discarded – undo
1277 1292
 	 */
1278 1293
 	public function reset()
1279 1294
 	{
1280
-		foreach($this->getFields() as $field)
1281
-			$field->reset();
1295
+		foreach($this->getFields() as $field) {
1296
+					$field->reset();
1297
+		}
1282 1298
 	}
1283 1299
 
1284 1300
 	/**
@@ -1298,7 +1314,9 @@  discard block
 block discarded – undo
1298 1314
 		$fake = [];
1299 1315
 		foreach($this->getFields() as $key => $field) {
1300 1316
 			$val = $field->fake();
1301
-			if (empty($val)) continue;
1317
+			if (empty($val)) {
1318
+				continue;
1319
+			}
1302 1320
 			$fake[$key] = $val;
1303 1321
 		}
1304 1322
 		return $fake;
Please login to merge, or discard this patch.
neon/core/form/FormField.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function __set($name, $value)
61 61
 	{
62
-		$setter = 'set' . $name;
62
+		$setter = 'set'.$name;
63 63
 		if (method_exists($this, $setter)) {
64 64
 			$this->$setter($value);
65 65
 		}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	public function getInputName()
166 166
 	{
167 167
 		if ($this->hasForm()) {
168
-			return $this->getForm()->getInputName() . '[' . $this->getName() . ']';
168
+			return $this->getForm()->getInputName().'['.$this->getName().']';
169 169
 		}
170 170
 		return $this->getName();
171 171
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		return Arr::get($this->_errors, 0, '');
210 210
 	}
211 211
 
212
-	public function setErrors($errors=[])
212
+	public function setErrors($errors = [])
213 213
 	{
214 214
 		$this->_errors = $errors;
215 215
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	/**
278 278
 	 * @inheritdoc
279 279
 	 */
280
-	public function setValidators($validators, $overwrite=true)
280
+	public function setValidators($validators, $overwrite = true)
281 281
 	{
282 282
 		if ($overwrite)
283 283
 			$this->_validators = [];
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		else if (is_string($validator)) {
335 335
 			$ret = ['class' => $validator];
336 336
 		} else {
337
-			throw new \Exception("Invalid validator information. Probably missing neon class. ".print_r($validator,true));
337
+			throw new \Exception("Invalid validator information. Probably missing neon class. ".print_r($validator, true));
338 338
 		}
339 339
 
340 340
 		// finally normalise the validator class
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 	/**
346 346
 	 * @inheritdoc
347 347
 	 */
348
-	public function addValidator($validator, $options = [], $fixedKey=null)
348
+	public function addValidator($validator, $options = [], $fixedKey = null)
349 349
 	{
350 350
 		$validatorObject = $this->createValidator($validator, $options, $key);
351 351
 		$this->_validators[$fixedKey ? $fixedKey : $key] = $validatorObject;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @param string $key - a key to identify this validator - an md5 hash of the validator and its options
360 360
 	 * @return \yii\validators\Validator
361 361
 	 */
362
-	public function createValidator($validator, $options=[], &$key='')
362
+	public function createValidator($validator, $options = [], &$key = '')
363 363
 	{
364 364
 		if (is_object($validator)) {
365 365
 			$validatorObject = $validator;
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	public function removeValidator($validator)
380 380
 	{
381 381
 		$class = $this->_getValidatorClass($validator);
382
-		foreach($this->_validators as $key => $validatorObject) {
382
+		foreach ($this->_validators as $key => $validatorObject) {
383 383
 			if ($validatorObject instanceof $class) {
384 384
 				unset($this->_validators[$key]);
385 385
 			}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 		// for example 'required' gives ['class'=>'\yii\validators\Required']
428 428
 		// otherwise assume a validator class string has been passed in
429 429
 		$class = $this->_getValidatorClass($class);
430
-		$value = collect($this->getValidators())->first(function ($validatorObject) use ($class) {
430
+		$value = collect($this->getValidators())->first(function($validatorObject) use ($class) {
431 431
 			return $validatorObject instanceof $class;
432 432
 		}, false);
433 433
 
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 	/**
458 458
 	 * @inheritdoc
459 459
 	 */
460
-	public function getIdPath($delimiter='.')
460
+	public function getIdPath($delimiter = '.')
461 461
 	{
462 462
 		// set the form id if not already set to something else
463 463
 		if ($this->isRootForm())
464 464
 			return $this->getId() ?: $this->getName();
465 465
 		return $this->hasForm()
466
-			? $this->getForm()->getIdPath($delimiter) . $delimiter . $this->getName()
466
+			? $this->getForm()->getIdPath($delimiter).$delimiter.$this->getName()
467 467
 			: $this->getName();
468 468
 	}
469 469
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -279,8 +279,9 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function setValidators($validators, $overwrite=true)
281 281
 	{
282
-		if ($overwrite)
283
-			$this->_validators = [];
282
+		if ($overwrite) {
283
+					$this->_validators = [];
284
+		}
284 285
 		if (is_array($validators)) {
285 286
 			foreach ($validators as $key => $validator) {
286 287
 				if (is_numeric($key)) {
@@ -407,10 +408,12 @@  discard block
 block discarded – undo
407 408
 	 */
408 409
 	protected function _getValidatorClass($class)
409 410
 	{
410
-		if (is_array($class) && isset($class['class']))
411
-			$class = $class['class'];
412
-		if (is_object($class))
413
-			$class = get_class($class);
411
+		if (is_array($class) && isset($class['class'])) {
412
+					$class = $class['class'];
413
+		}
414
+		if (is_object($class)) {
415
+					$class = get_class($class);
416
+		}
414 417
 
415 418
 		if (array_key_exists($class, Validator::$builtInValidators)) {
416 419
 			$class = Validator::$builtInValidators[$class]['class'];
@@ -460,8 +463,9 @@  discard block
 block discarded – undo
460 463
 	public function getIdPath($delimiter='.')
461 464
 	{
462 465
 		// set the form id if not already set to something else
463
-		if ($this->isRootForm())
464
-			return $this->getId() ?: $this->getName();
466
+		if ($this->isRootForm()) {
467
+					return $this->getId() ?: $this->getName();
468
+		}
465 469
 		return $this->hasForm()
466 470
 			? $this->getForm()->getIdPath($delimiter) . $delimiter . $this->getName()
467 471
 			: $this->getName();
Please login to merge, or discard this patch.
neon/core/config/console.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 		],
24 24
 		// the user module could define this on boot.
25 25
 		// but this is useful if you need to make any project specific adjustments
26
-		'session' => [ // for use session in console application
26
+		'session' => [// for use session in console application
27 27
 			'class' => 'yii\web\DbSession'
28 28
 		],
29 29
 		'assetManager'=>[
Please login to merge, or discard this patch.
neon/core/config/common.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 				// routes are either set by extending from AdminController or defined here
91 91
 				'neon-administrator' => [
92 92
 					'label' => 'Neon Administrator',
93
-					'routes' => [ '^/admin/.*' ],
93
+					'routes' => ['^/admin/.*'],
94 94
 					'homeUrl' => '/admin'  // default url if not going elsewhere
95 95
 				],
96 96
 				'neon-developer' => [
97 97
 					'label' => 'Neon Developer',
98
-					'routes' => [ '^/admin/.*' ],
98
+					'routes' => ['^/admin/.*'],
99 99
 					'homeUrl' => '/admin'  // default url if not going elsewhere
100 100
 				],
101 101
 			]
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 					'maxFileSize' => 1024 * 2,
289 289
 					'maxLogFiles' => 20,
290 290
 					'logVars' => ['_GET', '_POST', '_FILES', '_SESSION', '_SERVER'],
291
-					'maskVars' => ['_SERVER.HTTP_AUTHORIZATION','_SERVER.PHP_AUTH_USER','_SERVER.PHP_AUTH_PW','_SERVER.DB_PASSWORD','_SERVER.NEON_SECRET','_SERVER.NEON_ENCRYPTION_KEY', '_SERVER.HTTP_COOKIE']
291
+					'maskVars' => ['_SERVER.HTTP_AUTHORIZATION', '_SERVER.PHP_AUTH_USER', '_SERVER.PHP_AUTH_PW', '_SERVER.DB_PASSWORD', '_SERVER.NEON_SECRET', '_SERVER.NEON_ENCRYPTION_KEY', '_SERVER.HTTP_COOKIE']
292 292
 				],
293 293
 				'warning' => [
294 294
 					'class' => 'yii\log\FileTarget',
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 					'maxFileSize' => 1024 * 2,
298 298
 					'maxLogFiles' => 20,
299 299
 					'logVars' => ['_GET', '_POST', '_FILES', '_SESSION', '_SERVER'],
300
-					'maskVars' => ['_SERVER.HTTP_AUTHORIZATION','_SERVER.PHP_AUTH_USER','_SERVER.PHP_AUTH_PW','_SERVER.DB_PASSWORD','_SERVER.NEON_SECRET','_SERVER.NEON_ENCRYPTION_KEY']
300
+					'maskVars' => ['_SERVER.HTTP_AUTHORIZATION', '_SERVER.PHP_AUTH_USER', '_SERVER.PHP_AUTH_PW', '_SERVER.DB_PASSWORD', '_SERVER.NEON_SECRET', '_SERVER.NEON_ENCRYPTION_KEY']
301 301
 				],
302 302
 				'trace' => [
303 303
 					// to enable trace logging set ['components']['log']['targets']['trace']['enabled'] to true in the app config
Please login to merge, or discard this patch.
neon/core/Yii.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,5 +24,5 @@
 block discarded – undo
24 24
 
25 25
 spl_autoload_register(['Yii', 'autoload'], true, true);
26 26
 // Ability to replace any yii core class with an alternative
27
-Yii::$classMap = require YII2_PATH . '/classes.php';
27
+Yii::$classMap = require YII2_PATH.'/classes.php';
28 28
 Yii::$container = new yii\di\Container();
Please login to merge, or discard this patch.