Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/core/form/fields/Time.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 	{
56 56
 		$bits = explode(':', $timeString);
57 57
 		return [
58
-			'hh' => Arr::get($bits,0, '00'),
59
-			'mm' => Arr::get($bits,1, '00'),
60
-			'ss' => Arr::get($bits,2, '00')
58
+			'hh' => Arr::get($bits, 0, '00'),
59
+			'mm' => Arr::get($bits, 1, '00'),
60
+			'ss' => Arr::get($bits, 2, '00')
61 61
 		];
62 62
 	}
63 63
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	/**
108 108
 	 * @return string
109 109
 	 */
110
-	public function getValueDisplay($context='')
110
+	public function getValueDisplay($context = '')
111 111
 	{
112 112
 		// don't show seconds if they are not to be set
113 113
 		return neon()->formatter->asTime($this->getValue());
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	/**
126 126
 	 * @inheritdoc
127 127
 	 */
128
-	public function processAsFilter(IQuery $query, $searchData=null)
128
+	public function processAsFilter(IQuery $query, $searchData = null)
129 129
 	{
130 130
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
131 131
 		if (!empty($searchData)) {
Please login to merge, or discard this patch.
neon/core/form/fields/Real.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	/**
57 57
 	 * @inheritdoc
58 58
 	 */
59
-	public function getValueDisplay($context='')
59
+	public function getValueDisplay($context = '')
60 60
 	{
61 61
 		$value = $this->getValue();
62 62
 		if ($this->decimal === 0)
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public function setValue($value)
38 38
 	{
39
-		if (is_numeric($value))
40
-			return parent::setValue(round($value, $this->decimal));
39
+		if (is_numeric($value)) {
40
+					return parent::setValue(round($value, $this->decimal));
41
+		}
41 42
 		parent::setvalue(null);
42 43
 	}
43 44
 
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 	public function getValue()
48 49
 	{
49 50
 		// prevent returning 0 when casting a null value to a (real) number
50
-		if (!is_numeric($this->_value))
51
-			return null;
51
+		if (!is_numeric($this->_value)) {
52
+					return null;
53
+		}
52 54
 		// (real) has been deprecated >= PHP.4 - use float instead
53 55
 		return (float) $this->_value;
54 56
 	}
@@ -59,8 +61,9 @@  discard block
 block discarded – undo
59 61
 	public function getValueDisplay($context='')
60 62
 	{
61 63
 		$value = $this->getValue();
62
-		if ($this->decimal === 0)
63
-			return neon()->formatter->asInteger($value);
64
+		if ($this->decimal === 0) {
65
+					return neon()->formatter->asInteger($value);
66
+		}
64 67
 		return neon()->formatter->asDecimal($value, $this->decimal);
65 68
 	}
66 69
 
Please login to merge, or discard this patch.
neon/core/form/fields/SwitchButton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
 	/**
84 84
 	 * @inheritdoc
85 85
 	 */
86
-	public function getValueDisplay($context='')
86
+	public function getValueDisplay($context = '')
87 87
 	{
88 88
 		return $this->value ? $this->trueLabel : $this->falseLabel;
89 89
 	}
Please login to merge, or discard this patch.
neon/core/form/fields/Checkbox.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 	/**
79 79
 	 * @inheritdoc
80 80
 	 */
81
-	public function getValueDisplay($context='')
81
+	public function getValueDisplay($context = '')
82 82
 	{
83 83
 		return $this->getData() ? $this->trueLabel : $this->falseLabel;
84 84
 	}
Please login to merge, or discard this patch.
neon/core/form/fields/Email.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
 	{
30 30
 		parent::init();
31 31
 		// set up default email validator
32
-		if (!$this->hasValidator(\neon\core\validators\EmailValidator::class))
33
-			$this->addValidator('email');
32
+		if (!$this->hasValidator(\neon\core\validators\EmailValidator::class)) {
33
+					$this->addValidator('email');
34
+		}
34 35
 	}
35 36
 
36 37
 	/**
Please login to merge, or discard this patch.
neon/core/form/fields/Field.php 2 patches
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -205,8 +205,9 @@  discard block
 block discarded – undo
205 205
 		// By this point $config should be the required minimum config
206 206
 		// i.e. has a `name` property
207 207
 		// -----
208
-		if (isset($config['name']))
209
-			$this->setName($config['name']);
208
+		if (isset($config['name'])) {
209
+					$this->setName($config['name']);
210
+		}
210 211
 
211 212
 		// Configure the field - the name property must be set by this point.
212 213
 		// as many configuration options such as adding Validators and attaching
@@ -280,8 +281,9 @@  discard block
 block discarded – undo
280 281
 	 */
281 282
 	public function getComponentName()
282 283
 	{
283
-		if ($this->_componentName === null)
284
-			$this->_componentName = str_replace('\\', '-', get_class($this));
284
+		if ($this->_componentName === null) {
285
+					$this->_componentName = str_replace('\\', '-', get_class($this));
286
+		}
285 287
 		return $this->_componentName;
286 288
 	}
287 289
 
@@ -307,8 +309,9 @@  discard block
 block discarded – undo
307 309
 	 */
308 310
 	public function getDataKey()
309 311
 	{
310
-		if ($this->_dataKey === null)
311
-			return $this->getName();
312
+		if ($this->_dataKey === null) {
313
+					return $this->getName();
314
+		}
312 315
 		return $this->_dataKey;
313 316
 	}
314 317
 
@@ -345,8 +348,9 @@  discard block
 block discarded – undo
345 348
 	public function getValue()
346 349
 	{
347 350
 		// return sanitised data only
348
-		if ($this->_sanitisedValue === null)
349
-			$this->_sanitisedValue = $this->sanitiseInput($this->getUnsafeValue());
351
+		if ($this->_sanitisedValue === null) {
352
+					$this->_sanitisedValue = $this->sanitiseInput($this->getUnsafeValue());
353
+		}
350 354
 		return $this->_sanitisedValue;
351 355
 	}
352 356
 
@@ -388,8 +392,9 @@  discard block
 block discarded – undo
388 392
 	 */
389 393
 	protected function sanitiseInput($value)
390 394
 	{
391
-		if (empty($value))
392
-			return $value;
395
+		if (empty($value)) {
396
+					return $value;
397
+		}
393 398
 
394 399
 		profile_begin('form sanitise');
395 400
 		$sanitise = Html::sanitise($value, $this->allowableTags);
@@ -404,8 +409,9 @@  discard block
 block discarded – undo
404 409
 	 */
405 410
 	protected function purifyInput($value)
406 411
 	{
407
-		if (empty($value))
408
-			return $value;
412
+		if (empty($value)) {
413
+					return $value;
414
+		}
409 415
 
410 416
 		profile_begin('form purify');
411 417
 		$sanitise = Html::purify($value, $this->allowableTags);
@@ -536,8 +542,9 @@  discard block
 block discarded – undo
536 542
 	public function getErrorHtml()
537 543
 	{
538 544
 		$error = $this->getFirstError();
539
-		if ($error === '')
540
-			return '';
545
+		if ($error === '') {
546
+					return '';
547
+		}
541 548
 		$options = $this->errorOptions;
542 549
 		$tag = Arr::remove($options, 'tag', 'div');
543 550
 		$encode = Arr::remove($options, 'encode', true);
@@ -598,8 +605,9 @@  discard block
 block discarded – undo
598 605
 	public function validate()
599 606
 	{
600 607
 		$validators = $this->getValidators();
601
-		if (count($validators)==0)
602
-			return true;
608
+		if (count($validators)==0) {
609
+					return true;
610
+		}
603 611
 
604 612
 		$isEmpty = empty($this->getValue());
605 613
 		$hasErrors = $this->hasError();
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @param array $config
195 195
 	 * @throws InvalidNameFormat
196 196
 	 */
197
-	public function __construct($name=[], array $config=[])
197
+	public function __construct($name = [], array $config = [])
198 198
 	{
199 199
 		// The $name field can also be a configuration array
200 200
 		if (is_array($name)) {
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	public function getLabelHtml()
521 521
 	{
522
-		return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes ) : '';
522
+		return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes) : '';
523 523
 	}
524 524
 
525 525
 	/**
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	public function validate()
602 602
 	{
603 603
 		$validators = $this->getValidators();
604
-		if (count($validators)==0)
604
+		if (count($validators) == 0)
605 605
 			return true;
606 606
 
607 607
 		$isEmpty = empty($this->getValue());
@@ -630,10 +630,10 @@  discard block
 block discarded – undo
630 630
 					$validator->validateAttribute($form, $attribute);
631 631
 				} catch (UnknownPropertyException $e) {
632 632
 					throw new UnknownPropertyException(
633
-						'You are using a validator ' . get_class($validator) . ' that has a when clause or needs to use validateAttribute. '
633
+						'You are using a validator '.get_class($validator).' that has a when clause or needs to use validateAttribute. '
634 634
 						. 'This requires you to have <br><br>'
635
-						. 'public function get' . ucfirst($attribute) . "<br>{ <br>&nbsp;&nbsp;return \$this->getField(&quot;$attribute&quot;)->getValue()); <br>}"
636
-						. '<br><br>on the form. You may also need the equivalent set' . ucfirst($attribute) . ' method. <br>Error was ' . $e->getMessage());
635
+						. 'public function get'.ucfirst($attribute)."<br>{ <br>&nbsp;&nbsp;return \$this->getField(&quot;$attribute&quot;)->getValue()); <br>}"
636
+						. '<br><br>on the form. You may also need the equivalent set'.ucfirst($attribute).' method. <br>Error was '.$e->getMessage());
637 637
 				}
638 638
 			}
639 639
 		}
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	 * Get a displayable representation of the fields value to be output to html
762 762
 	 * @return string
763 763
 	 */
764
-	public function getValueDisplay($context='')
764
+	public function getValueDisplay($context = '')
765 765
 	{
766 766
 		return Html::encode($this->getValue());
767 767
 	}
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	/**
782 782
 	 * @inheritdoc
783 783
 	 */
784
-	public function processAsFilter(IQuery $query, $searchData=null)
784
+	public function processAsFilter(IQuery $query, $searchData = null)
785 785
 	{
786 786
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
787 787
 		// Note: we can not use empty here
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 	 * @param array|null $ddsMembers if not specified it will look up the members of the classType
841 841
 	 * @deprecated
842 842
 	 */
843
-	public function ddsSaveDefinition($classType=null, $ddsMembers=null)
843
+	public function ddsSaveDefinition($classType = null, $ddsMembers = null)
844 844
 	{
845 845
 		Deprecated::ddsSaveDefinitionField($this, $classType, $ddsMembers);
846 846
 	}
Please login to merge, or discard this patch.
neon/core/form/fields/File.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 	/**
98 98
 	 * @inheritdoc
99 99
 	 */
100
-	public function getValueDisplay($context='')
100
+	public function getValueDisplay($context = '')
101 101
 	{
102 102
 		if (empty($this->value))
103 103
 			return Html::encodeEntities($this->value);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,9 @@
 block discarded – undo
99 99
 	 */
100 100
 	public function getValueDisplay($context='')
101 101
 	{
102
-		if (empty($this->value))
103
-			return Html::encodeEntities($this->value);
102
+		if (empty($this->value)) {
103
+					return Html::encodeEntities($this->value);
104
+		}
104 105
 		return Html::a(neon()->firefly->getFileName($this->value), neon()->firefly->getUrl($this->value), ['target' => '_blank']);
105 106
 	}
106 107
 
Please login to merge, or discard this patch.
neon/core/form/fields/el/Color.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	/**
36 36
 	 * @inheritdoc
37 37
 	 */
38
-	public function processAsFilter(IQuery $query, $searchData=null)
38
+	public function processAsFilter(IQuery $query, $searchData = null)
39 39
 	{
40 40
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
41 41
 		if (!empty($searchData)) {
Please login to merge, or discard this patch.
neon/core/form/fields/el/Date.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	/**
51 51
 	 * @inheritdoc
52 52
 	 */
53
-	public function getValueDisplay($context='')
53
+	public function getValueDisplay($context = '')
54 54
 	{
55 55
 		return neon()->formatter->asDate($this->getValue());
56 56
 	}
Please login to merge, or discard this patch.