Passed
Push — releases ( 51c2cc...e1d10c )
by steve
39:06 queued 13:38
created
neon/core/form/fields/Textarea.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class Textarea extends Text
20 20
 {
21
-	const TEXT_TRUNCATE_LENGTH=250;
21
+	const TEXT_TRUNCATE_LENGTH = 250;
22 22
 
23 23
 	/**
24 24
 	 * Set some allowable tags for single text fields
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @inheritdoc
59 59
 	 */
60
-	public function processAsFilter(IQuery $query, $searchData=null)
60
+	public function processAsFilter(IQuery $query, $searchData = null)
61 61
 	{
62 62
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
63 63
 		if ($searchData !== '') {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@
 block discarded – undo
39 39
 	public function getValueDisplay()
40 40
 	{
41 41
 		$text = parent::getValueDisplay();
42
-		if (strlen($text) > self::TEXT_TRUNCATE_LENGTH)
43
-			return substr($text, 0, self::TEXT_TRUNCATE_LENGTH).'...';
42
+		if (strlen($text) > self::TEXT_TRUNCATE_LENGTH) {
43
+					return substr($text, 0, self::TEXT_TRUNCATE_LENGTH).'...';
44
+		}
44 45
 		return $text;
45 46
 	}
46 47
 
Please login to merge, or discard this patch.
neon/core/form/fields/Field.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 * @param array $config
191 191
 	 * @throws \neon\core\form\exceptions\InvalidNameFormat
192 192
 	 */
193
-	public function __construct($name=[], array $config=[])
193
+	public function __construct($name = [], array $config = [])
194 194
 	{
195 195
 		// The $name field can also be a configuration array
196 196
 		if (is_array($name)) {
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	public function getLabelHtml()
517 517
 	{
518
-		return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes ) : '';
518
+		return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes) : '';
519 519
 	}
520 520
 
521 521
 	/**
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 	public function validate()
598 598
 	{
599 599
 		$validators = $this->getValidators();
600
-		if (count($validators)==0)
600
+		if (count($validators) == 0)
601 601
 			return true;
602 602
 
603 603
 		$isEmpty = empty($this->getValue());
@@ -625,10 +625,10 @@  discard block
 block discarded – undo
625 625
 					$validator->validateAttribute($form, $attribute);
626 626
 				} catch (\yii\base\UnknownPropertyException $e) {
627 627
 					throw new UnknownPropertyException(
628
-						"You are using a validator " . get_class($validator) . " that has a when clause or needs to use validateAttribute. "
628
+						"You are using a validator ".get_class($validator)." that has a when clause or needs to use validateAttribute. "
629 629
 						. "This requires you to have <br><br>"
630
-						. "public function get" . ucfirst($attribute) . "<br>{ <br>&nbsp;&nbsp;return \$this->getField(&quot;$attribute&quot;)->getValue()); <br>}"
631
-						. "<br><br>on the form. You may also need the equivalent set" . ucfirst($attribute) . " method. <br>Error was " . $e->getMessage());
630
+						. "public function get".ucfirst($attribute)."<br>{ <br>&nbsp;&nbsp;return \$this->getField(&quot;$attribute&quot;)->getValue()); <br>}"
631
+						. "<br><br>on the form. You may also need the equivalent set".ucfirst($attribute)." method. <br>Error was ".$e->getMessage());
632 632
 				}
633 633
 			}
634 634
 		}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	/**
777 777
 	 * @inheritdoc
778 778
 	 */
779
-	public function processAsFilter(IQuery $query, $searchData=null)
779
+	public function processAsFilter(IQuery $query, $searchData = null)
780 780
 	{
781 781
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
782 782
 		// Note: we can not use empty here
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	 * @param array|null $ddsMembers if not specified it will look up the members of the classType
822 822
 	 * @deprecated
823 823
 	 */
824
-	public function ddsSaveDefinition($classType=null, $ddsMembers=null)
824
+	public function ddsSaveDefinition($classType = null, $ddsMembers = null)
825 825
 	{
826 826
 		Deprecated::ddsSaveDefinitionField($this, $classType, $ddsMembers);
827 827
 	}
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -204,8 +204,9 @@  discard block
 block discarded – undo
204 204
 		// By this point $config should be the required minimum config
205 205
 		// i.e. has a `name` property
206 206
 		// -----
207
-		if (isset($config['name']))
208
-			$this->setName($config['name']);
207
+		if (isset($config['name'])) {
208
+					$this->setName($config['name']);
209
+		}
209 210
 
210 211
 		// Configure the field - the name property must be set by this point.
211 212
 		// as many configuration options such as adding Validators and attaching
@@ -279,8 +280,9 @@  discard block
 block discarded – undo
279 280
 	 */
280 281
 	public function getComponentName()
281 282
 	{
282
-		if ($this->_componentName === null)
283
-			$this->_componentName = str_replace('\\', '-', get_class($this));
283
+		if ($this->_componentName === null) {
284
+					$this->_componentName = str_replace('\\', '-', get_class($this));
285
+		}
284 286
 		return $this->_componentName;
285 287
 	}
286 288
 
@@ -306,8 +308,9 @@  discard block
 block discarded – undo
306 308
 	 */
307 309
 	public function getDataKey()
308 310
 	{
309
-		if ($this->_dataKey === null)
310
-			return $this->getName();
311
+		if ($this->_dataKey === null) {
312
+					return $this->getName();
313
+		}
311 314
 		return $this->_dataKey;
312 315
 	}
313 316
 
@@ -344,8 +347,9 @@  discard block
 block discarded – undo
344 347
 	public function getValue()
345 348
 	{
346 349
 		// return sanitised data only
347
-		if ($this->_sanitisedValue === null)
348
-			$this->_sanitisedValue = $this->sanitiseInput($this->getUnsafeValue());
350
+		if ($this->_sanitisedValue === null) {
351
+					$this->_sanitisedValue = $this->sanitiseInput($this->getUnsafeValue());
352
+		}
349 353
 		return $this->_sanitisedValue;
350 354
 	}
351 355
 
@@ -387,8 +391,9 @@  discard block
 block discarded – undo
387 391
 	 */
388 392
 	protected function sanitiseInput($value)
389 393
 	{
390
-		if (empty($value))
391
-			return $value;
394
+		if (empty($value)) {
395
+					return $value;
396
+		}
392 397
 
393 398
 		profile_begin('form sanitise');
394 399
 		$sanitise = Html::sanitise($value, $this->allowableTags);
@@ -403,8 +408,9 @@  discard block
 block discarded – undo
403 408
 	 */
404 409
 	protected function purifyInput($value)
405 410
 	{
406
-		if (empty($value))
407
-			return $value;
411
+		if (empty($value)) {
412
+					return $value;
413
+		}
408 414
 
409 415
 		profile_begin('form purify');
410 416
 		$sanitise = Html::purify($value, $this->allowableTags);
@@ -535,8 +541,9 @@  discard block
 block discarded – undo
535 541
 	public function getErrorHtml()
536 542
 	{
537 543
 		$error = $this->getFirstError();
538
-		if ($error === '')
539
-			return '';
544
+		if ($error === '') {
545
+					return '';
546
+		}
540 547
 		$options = $this->errorOptions;
541 548
 		$tag = Arr::remove($options, 'tag', 'div');
542 549
 		$encode = Arr::remove($options, 'encode', true);
@@ -597,8 +604,9 @@  discard block
 block discarded – undo
597 604
 	public function validate()
598 605
 	{
599 606
 		$validators = $this->getValidators();
600
-		if (count($validators)==0)
601
-			return true;
607
+		if (count($validators)==0) {
608
+					return true;
609
+		}
602 610
 
603 611
 		$isEmpty = empty($this->getValue());
604 612
 		$hasErrors = $this->hasError();
@@ -615,8 +623,9 @@  discard block
 block discarded – undo
615 623
 			// ok - now apply the validator
616 624
 			try {
617 625
 				if ($validator->when == null || call_user_func($validator->when, $form, $attribute)) {
618
-					if (!$validator->validate($unsafeValue, $error))
619
-						$this->addError($error);
626
+					if (!$validator->validate($unsafeValue, $error)) {
627
+											$this->addError($error);
628
+					}
620 629
 				}
621 630
 			} catch (NotSupportedException $e) {
622 631
 				try {
Please login to merge, or discard this patch.
neon/core/form/fields/el/DateRange.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@
 block discarded – undo
31 31
 	public function getValue()
32 32
 	{
33 33
 		$value = parent::getValue();
34
-		if (is_array($value))
35
-			return $value;
34
+		if (is_array($value)) {
35
+					return $value;
36
+		}
36 37
 		return ['from' => '', 'to' => ''];
37 38
 	}
38 39
 
Please login to merge, or discard this patch.
neon/core/form/fields/el/DateTimeRange.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 	/**
61 61
 	 * @inheritdoc
62 62
 	 */
63
-	public function processAsFilter(IQuery $query, $searchData=null)
63
+	public function processAsFilter(IQuery $query, $searchData = null)
64 64
 	{
65 65
 		$searchData = ($searchData === null) ? $this->getValue() : $searchData;
66 66
 		if ($searchData !== '') {
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,10 +66,12 @@  discard block
 block discarded – undo
66 66
 		if ($searchData !== '') {
67 67
 			$dateFrom = Arr::get($searchData, 'from');
68 68
 			$dateTo   = Arr::get($searchData, 'to');
69
-			if ($dateFrom)
70
-				$query->where($this->getDataKey(), '>=', $dateFrom);
71
-			if ($dateTo)
72
-				$query->where($this->getDataKey(), '<=', $dateTo);
69
+			if ($dateFrom) {
70
+							$query->where($this->getDataKey(), '>=', $dateFrom);
71
+			}
72
+			if ($dateTo) {
73
+							$query->where($this->getDataKey(), '<=', $dateTo);
74
+			}
73 75
 		}
74 76
 	}
75 77
 
@@ -87,8 +89,9 @@  discard block
 block discarded – undo
87 89
 	public function getValue()
88 90
 	{
89 91
 		$value = parent::getValue();
90
-		if (is_array($value))
91
-			return $value;
92
+		if (is_array($value)) {
93
+					return $value;
94
+		}
92 95
 		return ['from' => '', 'to' => ''];
93 96
 	}
94 97
 }
95 98
\ No newline at end of file
Please login to merge, or discard this patch.
neon/core/form/fields/el/Slider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 */
26 26
 	public function getProperties()
27 27
 	{
28
-		return array_merge(parent::getProperties(), ['decimal', 'height', 'vertical', 'min', 'max'] );
28
+		return array_merge(parent::getProperties(), ['decimal', 'height', 'vertical', 'min', 'max']);
29 29
 	}
30 30
 	/**
31 31
 	 * @inheritdoc
Please login to merge, or discard this patch.
neon/core/form/fields/DisplayText.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
 	/**
74 74
 	 * @inheritdoc
75 75
 	 */
76
-	public function processAsFilter(IQuery $query, $searchData=null)
76
+	public function processAsFilter(IQuery $query, $searchData = null)
77 77
 	{
78 78
 		// no filters can be applied here - so we override and do nothing.
79 79
 	}
Please login to merge, or discard this patch.
neon/core/form/fields/Uuid64.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 	 */
44 44
 	public function getValueDisplay()
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/UrlLink.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * set whether or not this is an absolute or relative URL
23 23
 	 */
24
-	public $absolute=true;
24
+	public $absolute = true;
25 25
 
26 26
 	/**
27 27
 	 * Set some allowable tags for single text fields
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	public function getValueDisplay()
48 48
 	{
49
-		return '<a href="'.$this->getValue().'" target="_blank" noopener noreferrer>'.$this->getValue().'</a>' ;
49
+		return '<a href="'.$this->getValue().'" target="_blank" noopener noreferrer>'.$this->getValue().'</a>';
50 50
 	}
51 51
 
52 52
 	/**
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
 		if ($this->_sanitisedValue === null) {
60 60
 			$value = $this->getUnsafeValue();
61 61
 			// disallow any quotes in the URL to prevent a class of attacks
62
-			if (strpos($value, "'") === false && strpos($value,'"') === false) {
62
+			if (strpos($value, "'") === false && strpos($value, '"') === false) {
63 63
 				// prefix with the schema if not provided
64
-				if ($value && $this->absolute && strpos($value, 'http')===false)
65
-					$value = str_replace('///','//','https://'.$value);
64
+				if ($value && $this->absolute && strpos($value, 'http') === false)
65
+					$value = str_replace('///', '//', 'https://'.$value);
66 66
 				// now turn into a link and run through purify to strip
67 67
 				// out any dodgy shenanigans
68 68
 				$link = '<a href="'.$value.'">';
69 69
 				$safeValue = $this->purifyInput($link);
70 70
 				if (strpos($safeValue, 'href')) {
71
-					$exploded = explode('"',$safeValue);
71
+					$exploded = explode('"', $safeValue);
72 72
 					$this->_sanitisedValue = $exploded[1];
73 73
 				}
74 74
 			} else
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function getProperties()
84 84
 	{
85 85
 		// convert the database values to booleans
86
-		$this->absolute = (bool)$this->absolute;
86
+		$this->absolute = (bool) $this->absolute;
87 87
 		$properties = parent::getProperties();
88 88
 		$properties[] = 'absolute';
89 89
 		return $properties;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
 			// disallow any quotes in the URL to prevent a class of attacks
62 62
 			if (strpos($value, "'") === false && strpos($value,'"') === false) {
63 63
 				// prefix with the schema if not provided
64
-				if ($value && $this->absolute && strpos($value, 'http')===false)
65
-					$value = str_replace('///','//','https://'.$value);
64
+				if ($value && $this->absolute && strpos($value, 'http')===false) {
65
+									$value = str_replace('///','//','https://'.$value);
66
+				}
66 67
 				// now turn into a link and run through purify to strip
67 68
 				// out any dodgy shenanigans
68 69
 				$link = '<a href="'.$value.'">';
@@ -71,8 +72,9 @@  discard block
 block discarded – undo
71 72
 					$exploded = explode('"',$safeValue);
72 73
 					$this->_sanitisedValue = $exploded[1];
73 74
 				}
74
-			} else
75
-				$this->_sanitisedValue = '';
75
+			} else {
76
+							$this->_sanitisedValue = '';
77
+			}
76 78
 		}
77 79
 		return $this->_sanitisedValue;
78 80
 	}
Please login to merge, or discard this patch.
neon/core/form/fields/FileBrowser.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function getFieldHtml()
42 42
 	{
43
-		return "<div id=\"{$this->getId()}\">" .
44
-			"<firefly-form-file-browser value=\"{$this->value}\" name=\"{$this->getInputName()}\"></firefly-form-file-browser>" .
43
+		return "<div id=\"{$this->getId()}\">".
44
+			"<firefly-form-file-browser value=\"{$this->value}\" name=\"{$this->getInputName()}\"></firefly-form-file-browser>".
45 45
 		"</div>";
46 46
 	}
47 47
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	public function getData()
61 61
 	{
62 62
 		$name = $this->getInputName();
63
-		if ( neon()->request->hasFile($name) ) {
63
+		if (neon()->request->hasFile($name)) {
64 64
 			$this->value = neon()->request->file($name)->save();
65 65
 		}
66 66
 		return $this->value;
Please login to merge, or discard this patch.