Passed
Push — develop ( 7bdbd7...e398eb )
by Neill
33:33 queued 15s
created
neon/core/form/fields/DateRange.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -96,10 +96,12 @@
 block discarded – undo
96 96
 		if ($searchData !== '') {
97 97
 			$dateFrom = Arr::get($searchData, 'from');
98 98
 			$dateTo   = Arr::get($searchData, 'to');
99
-			if ($dateFrom)
100
-				$query->where($this->getDataKey(), '>=', $dateFrom);
101
-			if ($dateTo)
102
-				$query->where($this->getDataKey(), '<=', $dateTo);
99
+			if ($dateFrom) {
100
+							$query->where($this->getDataKey(), '>=', $dateFrom);
101
+			}
102
+			if ($dateTo) {
103
+							$query->where($this->getDataKey(), '<=', $dateTo);
104
+			}
103 105
 		}
104 106
 	}
105 107
 
Please login to merge, or discard this patch.
neon/core/form/fields/SelectDynamic.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -96,8 +96,9 @@  discard block
 block discarded – undo
96 96
 	public function getItems()
97 97
 	{
98 98
 		// if we haven't or can't map a map request we can't have any values
99
-		if (empty($this->dataMapKey))
100
-			return [];
99
+		if (empty($this->dataMapKey)) {
100
+					return [];
101
+		}
101 102
 
102 103
 		$provider = $this->getProviderService();
103 104
 		$format = false;
@@ -119,8 +120,9 @@  discard block
 block discarded – undo
119 120
 			$concat = isset($format['concat']) ? $format['concat'] : ' ';
120 121
 			$prefix = isset($format['prefix']) ? $format['prefix'] : '';
121 122
 			$postfix = isset($format['postfix']) ? $format['postfix'] : '';
122
-			foreach ($items as $k=>$i)
123
-				$items[$k] = $prefix.implode($concat, is_array($i) ? $i : [$i]).$postfix;
123
+			foreach ($items as $k=>$i) {
124
+							$items[$k] = $prefix.implode($concat, is_array($i) ? $i : [$i]).$postfix;
125
+			}
124 126
 		}
125 127
 		return $items;
126 128
 	}
@@ -184,8 +186,9 @@  discard block
 block discarded – undo
184 186
 	public function setValueFromDb($value)
185 187
 	{
186 188
 		parent::setValueFromDb($value);
187
-		if (!empty($value))
188
-			$this->makeMapRequest($value);
189
+		if (!empty($value)) {
190
+					$this->makeMapRequest($value);
191
+		}
189 192
 		return $this;
190 193
 	}
191 194
 
Please login to merge, or discard this patch.
neon/core/form/fields/Submit.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@
 block discarded – undo
52 52
 	 */
53 53
 	public function setValue($value)
54 54
 	{
55
-		if ($value === 'true' || $value === true)
56
-			$this->getForm()->submittedButton=$this->getName();
55
+		if ($value === 'true' || $value === true) {
56
+					$this->getForm()->submittedButton=$this->getName();
57
+		}
57 58
 		return $this;
58 59
 	}
59 60
 }
60 61
\ No newline at end of file
Please login to merge, or discard this patch.
neon/core/form/fields/Text.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@
 block discarded – undo
50 50
 	{
51 51
 		$guesser = new \Faker\Guesser\Name(faker());
52 52
 		$guess = $guesser->guessFormat($this->getName(), 150);
53
-		if (is_callable($guess))
54
-			return $guess();
53
+		if (is_callable($guess)) {
54
+					return $guess();
55
+		}
55 56
 		return faker()->realText(mt_rand(10, 150));
56 57
 	}
57 58
 }
58 59
\ No newline at end of file
Please login to merge, or discard this patch.
neon/core/form/fields/Textarea.php 1 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 1 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 1 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/UrlLink.php 1 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.