Passed
Push — master ( a67f6b...254bb0 )
by Jean-Christophe
02:30
created
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function fieldAsLabel($index, $icon = NULL, $attributes = NULL) {
127 127
 		return $this->_fieldAs(function ($id, $name, $value) use ($icon) {
128 128
 			$lbl = new HtmlLabel($id, $value);
129
-			if (isset($icon))
130
-				$lbl->addIcon($icon);
129
+			if (isset($icon)) {
130
+							$lbl->addIcon($icon);
131
+			}
131 132
 			return $lbl;
132 133
 		}, $index, $attributes, "label");
133 134
 	}
@@ -135,8 +136,9 @@  discard block
 block discarded – undo
135 136
 	public function fieldAsHeader($index, $niveau = 1, $icon = NULL, $attributes = NULL) {
136 137
 		return $this->_fieldAs(function ($id, $name, $value) use ($niveau, $icon) {
137 138
 			$header = new HtmlHeader($id, $niveau, $value);
138
-			if (isset($icon))
139
-				$header->asIcon($icon, $value);
139
+			if (isset($icon)) {
140
+							$header->asIcon($icon, $value);
141
+			}
140 142
 			return $header;
141 143
 		}, $index, $attributes, "header");
142 144
 	}
@@ -145,8 +147,9 @@  discard block
 block discarded – undo
145 147
 		$this->setValueFunction($index, function ($img) use ($size, $circular) {
146 148
 			$image = new HtmlImage($this->_getFieldIdentifier("image"), $img);
147 149
 			$image->setSize($size);
148
-			if ($circular)
149
-				$image->setCircular();
150
+			if ($circular) {
151
+							$image->setCircular();
152
+			}
150 153
 			return $image;
151 154
 		});
152 155
 		return $this;
@@ -251,8 +254,9 @@  discard block
 block discarded – undo
251 254
 
252 255
 	public function fieldAsCheckbox($index, $attributes = NULL) {
253 256
 		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
254
-			if ($caption === null || $caption === "")
255
-				$caption = "";
257
+			if ($caption === null || $caption === "") {
258
+							$caption = "";
259
+			}
256 260
 			$input = new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
257 261
 			$input->setChecked(JString::isBooleanTrue($value));
258 262
 			return $this->_prepareFormFields($input, $name, $attributes);
@@ -292,9 +296,9 @@  discard block
 block discarded – undo
292 296
 		$i = 0;
293 297
 		if (JArray::isAssociative($types)) {
294 298
 			foreach ($types as $type => $attributes) {
295
-				if (\is_int($type))
296
-					$this->fieldAs($i ++, $attributes, []);
297
-				else {
299
+				if (\is_int($type)) {
300
+									$this->fieldAs($i ++, $attributes, []);
301
+				} else {
298 302
 					$type = preg_replace('/\d/', '', $type);
299 303
 					$this->fieldAs($i ++, $type, $attributes);
300 304
 				}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsActionsTrait.php 1 patch
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 			$callback = ", function(){\n{$callback}\n}";
35 35
 		}
36 36
 		$str = "$({$element}).{$action}({$speed}{$callback});";
37
-		if ($immediatly)
38
-			$this->jquery_code_for_compile [] = $str;
37
+		if ($immediatly) {
38
+					$this->jquery_code_for_compile [] = $str;
39
+		}
39 40
 		return $str;
40 41
 	}
41 42
 
@@ -73,10 +74,12 @@  discard block
 block discarded – undo
73 74
 		if (isset ( $param )) {
74 75
 			$param = Javascript::prep_value ( $param );
75 76
 			$str = "$({$element}).{$jQueryCall}({$param});";
76
-		} else
77
-			$str = "$({$element}).{$jQueryCall}();";
78
-		if ($immediatly)
79
-			$this->jquery_code_for_compile [] = $str;
77
+		} else {
78
+					$str = "$({$element}).{$jQueryCall}();";
79
+		}
80
+		if ($immediatly) {
81
+					$this->jquery_code_for_compile [] = $str;
82
+		}
80 83
 		return $str;
81 84
 	}
82 85
 
@@ -94,8 +97,9 @@  discard block
 block discarded – undo
94 97
 		$to = Javascript::prep_element ( $to );
95 98
 		$element = Javascript::prep_element ( $element );
96 99
 		$str = "$({$to}).{$jQueryCall}({$element});";
97
-		if ($immediatly)
98
-			$this->jquery_code_for_compile [] = $str;
100
+		if ($immediatly) {
101
+					$this->jquery_code_for_compile [] = $str;
102
+		}
99 103
 		return $str;
100 104
 	}
101 105
 
@@ -153,10 +157,12 @@  discard block
 block discarded – undo
153 157
 		if (isset ( $value )) {
154 158
 			$value = Javascript::prep_value ( $value );
155 159
 			$str = "$({$element}).attr(\"$attributeName\",{$value});";
156
-		} else
157
-			$str = "$({$element}).attr(\"$attributeName\");";
158
-		if ($immediatly)
159
-			$this->jquery_code_for_compile [] = $str;
160
+		} else {
161
+					$str = "$({$element}).attr(\"$attributeName\");";
162
+		}
163
+		if ($immediatly) {
164
+					$this->jquery_code_for_compile [] = $str;
165
+		}
160 166
 		return $str;
161 167
 	}
162 168
 
@@ -219,8 +225,9 @@  discard block
 block discarded – undo
219 225
 
220 226
 		$str = "$({$element}).animate({\n$animations\n\t\t}" . $speed . $extra . ");";
221 227
 
222
-		if ($immediatly)
223
-			$this->jquery_code_for_compile [] = $str;
228
+		if ($immediatly) {
229
+					$this->jquery_code_for_compile [] = $str;
230
+		}
224 231
 		return $str;
225 232
 	}
226 233
 
@@ -410,8 +417,9 @@  discard block
 block discarded – undo
410 417
 		$element = Javascript::prep_element ( $element );
411 418
 		$str = "$({$element}).trigger(\"$event\");";
412 419
 
413
-		if ($immediatly)
414
-			$this->jquery_code_for_compile [] = $str;
420
+		if ($immediatly) {
421
+					$this->jquery_code_for_compile [] = $str;
422
+		}
415 423
 		return $str;
416 424
 	}
417 425
 
@@ -481,8 +489,9 @@  discard block
 block discarded – undo
481 489
 			$str .= "else{" . $jsCodeIfFalse . "}";
482 490
 		}
483 491
 
484
-		if ($immediatly)
485
-			$this->jquery_code_for_compile [] = $str;
492
+		if ($immediatly) {
493
+					$this->jquery_code_for_compile [] = $str;
494
+		}
486 495
 		return $str;
487 496
 	}
488 497
 
@@ -500,11 +509,13 @@  discard block
 block discarded – undo
500 509
 	private function _doJQuery($element, $jqueryCall, $param = "", $jsCallback = "", $immediatly = false) {
501 510
 		$param = Javascript::prep_value ( $param );
502 511
 		$callback = "";
503
-		if ($jsCallback != "")
504
-			$callback = ", function(event){\n{$jsCallback}\n}";
512
+		if ($jsCallback != "") {
513
+					$callback = ", function(event){\n{$jsCallback}\n}";
514
+		}
505 515
 		$script = "$(" . Javascript::prep_element ( $element ) . ")." . $jqueryCall . "(" . $param . $callback . ");\n";
506
-		if ($immediatly)
507
-			$this->jquery_code_for_compile [] = $script;
516
+		if ($immediatly) {
517
+					$this->jquery_code_for_compile [] = $script;
518
+		}
508 519
 		return $script;
509 520
 	}
510 521
 
@@ -591,8 +602,9 @@  discard block
 block discarded – undo
591 602
 	 */
592 603
 	public function exec($js, $immediatly = false) {
593 604
 		$script = $js . "\n";
594
-		if ($immediatly)
595
-			$this->jquery_code_for_compile [] = $script;
605
+		if ($immediatly) {
606
+					$this->jquery_code_for_compile [] = $script;
607
+		}
596 608
 		return $script;
597 609
 	}
598 610
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +28 added lines, -23 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
35 35
 		$this->widgetIdentifier = $identifier;
36 36
 		$this->values = [];
37 37
 		$this->afterCompile = [];
38
-		if (isset($instance))
39
-			$this->setInstance($instance);
38
+		if (isset($instance)) {
39
+					$this->setInstance($instance);
40
+		}
40 41
 		$this->setCaptions($captions);
41 42
 		$this->captionCallback = NULL;
42 43
 		$this->defaultValueFunction = function ($name, $value) {
@@ -86,14 +87,16 @@  discard block
 block discarded – undo
86 87
 	}
87 88
 
88 89
 	public function getIdentifier($index = NULL) {
89
-		if (! isset($index))
90
-			$index = self::$index;
90
+		if (! isset($index)) {
91
+					$index = self::$index;
92
+		}
91 93
 		$value = $index;
92 94
 		if (isset($this->values["identifier"])) {
93
-			if (\is_string($this->values["identifier"]))
94
-				$value = JReflection::callMethod($this->instance, $this->values["identifier"], []);
95
-			else
96
-				$value = $this->values["identifier"]($index, $this->instance);
95
+			if (\is_string($this->values["identifier"])) {
96
+							$value = JReflection::callMethod($this->instance, $this->values["identifier"], []);
97
+			} else {
98
+							$value = $this->values["identifier"]($index, $this->instance);
99
+			}
97 100
 		}
98 101
 		return $value;
99 102
 	}
@@ -124,9 +127,8 @@  discard block
 block discarded – undo
124 127
 		} elseif (\is_callable($property) && \array_search($property, ['system','date']) === false){
125 128
 			try{
126 129
 				$value = $property($this->instance);
127
-			}catch(\Error $e){}
128
-		}
129
-		elseif (\is_array($property)) {
130
+			} catch(\Error $e){}
131
+		} elseif (\is_array($property)) {
130 132
 			$values = \array_map(function ($v) use ($index) {
131 133
 				return $this->_getValue($v, $index);
132 134
 			}, $property);
@@ -280,10 +282,11 @@  discard block
 block discarded – undo
280 282
 			}
281 283
 		} elseif (\is_int($property)) {
282 284
 			$props = $this->getDefaultProperties();
283
-			if (isset($props[$property]))
284
-				$this->properties[] = $props[$property];
285
-			else
286
-				$this->properties[] = $property;
285
+			if (isset($props[$property])) {
286
+							$this->properties[] = $props[$property];
287
+			} else {
288
+							$this->properties[] = $property;
289
+			}
287 290
 		} else {
288 291
 			$this->properties[] = $property;
289 292
 		}
@@ -328,12 +331,13 @@  discard block
 block discarded – undo
328 331
 		if (isset($this->captions[$index])) {
329 332
 			return $this->captions[$index];
330 333
 		}
331
-		if ($this->properties[$index] instanceof \ReflectionProperty)
332
-			return $this->properties[$index]->getName();
333
-		elseif (\is_callable($this->properties[$index]))
334
-			return "";
335
-		else
336
-			return $this->properties[$index];
334
+		if ($this->properties[$index] instanceof \ReflectionProperty) {
335
+					return $this->properties[$index]->getName();
336
+		} elseif (\is_callable($this->properties[$index])) {
337
+					return "";
338
+		} else {
339
+					return $this->properties[$index];
340
+		}
337 341
 	}
338 342
 
339 343
 	public function getCaptions() {
@@ -366,8 +370,9 @@  discard block
 block discarded – undo
366 370
 	}
367 371
 
368 372
 	public function setCaption($index, $caption) {
369
-		if (isset($this->captions) === false)
370
-			$this->captions = [];
373
+		if (isset($this->captions) === false) {
374
+					$this->captions = [];
375
+		}
371 376
 		$this->captions[$index] = $caption;
372 377
 		return $this;
373 378
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlTab.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -86,8 +86,9 @@  discard block
 block discarded – undo
86 86
 			if (isset($this->content[$index]) === false) {
87 87
 				$this->content[$index] = $this->createSegment($index, $content, $menu->getItem($index)
88 88
 					->getIdentifier());
89
-			} else
90
-				$this->content[$index]->setContent($content);
89
+			} else {
90
+							$this->content[$index]->setContent($content);
91
+			}
91 92
 		}
92 93
 		return $this;
93 94
 	}
@@ -281,15 +282,17 @@  discard block
 block discarded – undo
281 282
 	 * @see BaseHtml::run()
282 283
 	 */
283 284
 	public function run(JsUtils $js) {
284
-		if (isset($this->_bsComponent) === false)
285
-			$this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params);
285
+		if (isset($this->_bsComponent) === false) {
286
+					$this->_bsComponent = $js->semantic()->tab("#" . $this->identifier . " .item", $this->params);
287
+		}
286 288
 		$this->addEventsOnRun($js);
287 289
 		return $this->_bsComponent;
288 290
 	}
289 291
 
290 292
 	public function compile(JsUtils $js = NULL, &$view = NULL) {
291
-		if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1)
292
-			$this->activate(0);
293
+		if (! $this->_activated && $this->content["menu"]->count() > 0 && \sizeof($this->content) > 1) {
294
+					$this->activate(0);
295
+		}
293 296
 		return parent::compile($js, $view);
294 297
 	}
295 298
 	
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -288,8 +288,9 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	public function addItemInToolbar($caption, $icon = NULL, $callback = NULL) {
290 290
 		$result = $this->addInToolbar($caption, $callback);
291
-		if (isset($icon) && method_exists($result, "addIcon"))
292
-			$result->addIcon($icon);
291
+		if (isset($icon) && method_exists($result, "addIcon")) {
292
+					$result->addIcon($icon);
293
+		}
293 294
 		return $result;
294 295
 	}
295 296
 
@@ -478,8 +479,9 @@  discard block
 block discarded – undo
478 479
 	protected function _compileForm() {
479 480
 		if (isset($this->_form)) {
480 481
 			$noValidate = "";
481
-			if (\sizeof($this->_form->getValidationParams()) > 0)
482
-				$noValidate = "novalidate";
482
+			if (\sizeof($this->_form->getValidationParams()) > 0) {
483
+							$noValidate = "novalidate";
484
+			}
483 485
 				$this->wrapContent("<form class='".$this->_form->getProperty('class')."' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
484 486
 		}
485 487
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -71,8 +71,9 @@  discard block
 block discarded – undo
71 71
 		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
72 72
 
73 73
 		$retour = $this->_addJsCondition($jsCondition, $retour);
74
-		if ($immediatly)
75
-			$this->jquery_code_for_compile[] = $retour;
74
+		if ($immediatly) {
75
+					$this->jquery_code_for_compile[] = $retour;
76
+		}
76 77
 		return $retour;
77 78
 	}
78 79
 
@@ -155,10 +156,11 @@  discard block
 block discarded – undo
155 156
 			} elseif (isset($this->ajaxTransition)) {
156 157
 				$call = $this->ajaxTransition;
157 158
 			}
158
-			if (\is_callable($call))
159
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
160
-			else
161
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
159
+			if (\is_callable($call)) {
160
+							$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
161
+			} else {
162
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
163
+			}
162 164
 		}
163 165
 		if (isset($history)) {
164 166
 			if ($this->params["autoActiveLinks"]) {
@@ -183,8 +185,9 @@  discard block
 block discarded – undo
183 185
 	}
184 186
 
185 187
 	protected function _correctAjaxUrl($url) {
186
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
187
-			$url = substr($url, 0, strlen($url) - 1);
188
+		if ($url !== "/" && JString::endsWith($url, "/") === true) {
189
+					$url = substr($url, 0, strlen($url) - 1);
190
+		}
188 191
 		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
189 192
 			$url = $this->getUrl($url);
190 193
 		}
@@ -208,8 +211,9 @@  discard block
 block discarded – undo
208 211
 	public static function _implodeParams($parameters) {
209 212
 		$allParameters = [];
210 213
 		foreach ($parameters as $params) {
211
-			if (isset($params))
212
-				$allParameters[] = self::_correctParams($params);
214
+			if (isset($params)) {
215
+							$allParameters[] = self::_correctParams($params);
216
+			}
213 217
 		}
214 218
 		return \implode("+'&'+", $allParameters);
215 219
 	}
@@ -243,8 +247,9 @@  discard block
 block discarded – undo
243 247
 
244 248
 	protected function setDefaultParameters(&$parameters, $default) {
245 249
 		foreach ($default as $k => $v) {
246
-			if (! isset($parameters[$k]))
247
-				$parameters[$k] = $v;
250
+			if (! isset($parameters[$k])) {
251
+							$parameters[$k] = $v;
252
+			}
248 253
 		}
249 254
 	}
250 255
 
@@ -775,8 +780,9 @@  discard block
 block discarded – undo
775 780
 			$retour .= "$('#" . $form . "').submit();\n";
776 781
 		}
777 782
 		$retour = $this->_addJsCondition($jsCondition, $retour);
778
-		if ($immediatly)
779
-			$this->jquery_code_for_compile[] = $retour;
783
+		if ($immediatly) {
784
+					$this->jquery_code_for_compile[] = $retour;
785
+		}
780 786
 		return $retour;
781 787
 	}
782 788
 
Please login to merge, or discard this patch.