Passed
Push — master ( f022dc...ec835f )
by Jean-Christophe
02:32
created
Ajax/service/AjaxCall.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,9 @@
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	public function compile(JsUtils $js = null) {
18
-		if ($js === null)
19
-			return;
18
+		if ($js === null) {
19
+					return;
20
+		}
20 21
 		$params = "{}";
21 22
 		$stopPropagation = true;
22 23
 		$preventDefault = true;
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='ui form' id='frm-" . $this->identifier . "' name='frm-" . $this->identifier . "' " . $noValidate . ">", "</form>");
484 486
 		}
485 487
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -82,16 +82,19 @@  discard block
 block discarded – undo
82 82
 					"stopPropagation" => true
83 83
 				]);
84 84
 			}
85
-			if (\is_array($this->_deleteBehavior))
86
-				$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
87
-			if (\is_array($this->_editBehavior))
88
-				$this->_generateBehavior("edit", $this->_editBehavior, $js);
85
+			if (\is_array($this->_deleteBehavior)) {
86
+							$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
87
+			}
88
+			if (\is_array($this->_editBehavior)) {
89
+							$this->_generateBehavior("edit", $this->_editBehavior, $js);
90
+			}
89 91
 			if (\is_array($this->_displayBehavior)) {
90 92
 				$this->_generateBehavior("display", $this->_displayBehavior, $js);
91 93
 			}
92 94
 			parent::run($js);
93
-			if (isset($this->_pagination))
94
-				$this->_associatePaginationBehavior($js, $offset);
95
+			if (isset($this->_pagination)) {
96
+							$this->_associatePaginationBehavior($js, $offset);
97
+			}
95 98
 			$this->_associateSearchFieldBehavior($js, $offset);
96 99
 			$this->_runned = true;
97 100
 		}
@@ -142,8 +145,9 @@  discard block
 block discarded – undo
142 145
 			$table->setRowCount(0, \sizeof($captions));
143 146
 			$this->_generateHeader($table, $captions);
144 147
 
145
-			if (isset($this->_compileParts))
146
-				$table->setCompileParts($this->_compileParts);
148
+			if (isset($this->_compileParts)) {
149
+							$table->setCompileParts($this->_compileParts);
150
+			}
147 151
 
148 152
 			$this->_generateContent($table);
149 153
 
@@ -178,8 +182,9 @@  discard block
 block discarded – undo
178 182
 	}
179 183
 
180 184
 	protected function _applyStyleAttributes($table) {
181
-		if (isset($this->_hiddenColumns))
182
-			$this->_hideColumns();
185
+		if (isset($this->_hiddenColumns)) {
186
+					$this->_hideColumns();
187
+		}
183 188
 		if (isset($this->_colWidths)) {
184 189
 			foreach ($this->_colWidths as $colIndex => $width) {
185 190
 				$table->setColWidth($colIndex, $width);
@@ -288,8 +293,9 @@  discard block
 block discarded – undo
288 293
 			$field = $ck->getField();
289 294
 			$field->setProperty("value", $dataAjax);
290 295
 			$field->setProperty("name", "selection[]");
291
-			if (isset($checkedClass))
292
-				$field->setClass($checkedClass);
296
+			if (isset($checkedClass)) {
297
+							$field->setClass($checkedClass);
298
+			}
293 299
 			\array_unshift($values, $ck);
294 300
 		}
295 301
 		$result = $table->newRow();
@@ -306,8 +312,9 @@  discard block
 block discarded – undo
306 312
 
307 313
 	protected function _generatePagination($table) {
308 314
 		if (isset($this->_toolbar)) {
309
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
310
-				$this->_toolbar->setFloated("left");
315
+			if ($this->_toolbarPosition == PositionInTable::FOOTER) {
316
+							$this->_toolbar->setFloated("left");
317
+			}
311 318
 		}
312 319
 		$footer = $table->getFooter();
313 320
 		$footer->mergeCol();
@@ -347,8 +354,9 @@  discard block
 block discarded – undo
347 354
 
348 355
 	protected function _getFieldName($index) {
349 356
 		$fieldName = parent::_getFieldName($index);
350
-		if (\is_object($fieldName))
351
-			$fieldName = "field-" . $index;
357
+		if (\is_object($fieldName)) {
358
+					$fieldName = "field-" . $index;
359
+		}
352 360
 		return $fieldName . "[]";
353 361
 	}
354 362
 
@@ -527,8 +535,9 @@  discard block
 block discarded – undo
527 535
 
528 536
 	protected function getTargetSelector($op) {
529 537
 		$result = $this->_targetSelector;
530
-		if (! isset($result[$op]))
531
-			$result = "#" . $this->identifier;
538
+		if (! isset($result[$op])) {
539
+					$result = "#" . $this->identifier;
540
+		}
532 541
 		return $result[$op];
533 542
 	}
534 543
 
@@ -551,8 +560,9 @@  discard block
 block discarded – undo
551 560
 	}
552 561
 
553 562
 	public function getRefreshSelector() {
554
-		if (isset($this->_refreshSelector))
555
-			return $this->_refreshSelector;
563
+		if (isset($this->_refreshSelector)) {
564
+					return $this->_refreshSelector;
565
+		}
556 566
 		return "#" . $this->identifier . " tbody";
557 567
 	}
558 568
 
@@ -573,8 +583,9 @@  discard block
 block discarded – undo
573 583
 	 */
574 584
 	public function show($modelInstance) {
575 585
 		if (\is_array($modelInstance)) {
576
-			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
577
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
586
+			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
587
+							$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
588
+			}
578 589
 		}
579 590
 		$this->_modelInstance = $modelInstance;
580 591
 	}
@@ -616,8 +627,9 @@  discard block
 block discarded – undo
616 627
 	}
617 628
 
618 629
 	public function hideColumn($colIndex) {
619
-		if (! \is_array($this->_hiddenColumns))
620
-			$this->_hiddenColumns = [];
630
+		if (! \is_array($this->_hiddenColumns)) {
631
+					$this->_hiddenColumns = [];
632
+		}
621 633
 		$this->_hiddenColumns[] = $colIndex;
622 634
 		return $this;
623 635
 	}
Please login to merge, or discard this patch.
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/JsUtilsAjaxTrait.php 1 patch
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@  discard block
 block discarded – undo
60 60
 		$retour .= $this->_getOnAjaxDone ( $responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null) ) . "});\n";
61 61
 
62 62
 		$retour = $this->_addJsCondition ( $jsCondition, $retour );
63
-		if ($immediatly)
64
-			$this->jquery_code_for_compile [] = $retour;
63
+		if ($immediatly) {
64
+					$this->jquery_code_for_compile [] = $retour;
65
+		}
65 66
 		return $retour;
66 67
 	}
67 68
 	protected function createAjaxParameters(&$original, $parameters) {
@@ -112,8 +113,9 @@  discard block
 block discarded – undo
112 113
 				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
113 114
 			} elseif (\substr ( $attr, 0, 3 ) === "js:") {
114 115
 				$retour .= "url=url+'" . $slash . "'+" . \substr ( $attr, 3 ) . ";\n";
115
-			} elseif ($attr !== null && $attr !== "")
116
-				$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
116
+			} elseif ($attr !== null && $attr !== "") {
117
+							$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
118
+			}
117 119
 		}
118 120
 		return $retour;
119 121
 	}
@@ -134,10 +136,11 @@  discard block
 block discarded – undo
134 136
 			} elseif (isset ( $this->ajaxTransition )) {
135 137
 				$call = $this->ajaxTransition;
136 138
 			}
137
-			if (\is_callable ( $call ))
138
-				$retour = "\t" . $call ( $responseElement, $jqueryDone ) . ";\n";
139
-			else
140
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
139
+			if (\is_callable ( $call )) {
140
+							$retour = "\t" . $call ( $responseElement, $jqueryDone ) . ";\n";
141
+			} else {
142
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
143
+			}
141 144
 		}
142 145
 		if (isset ( $history )) {
143 146
 			if ($this->params ["autoActiveLinks"]) {
@@ -158,8 +161,9 @@  discard block
 block discarded – undo
158 161
 		return $responseElement;
159 162
 	}
160 163
 	protected function _correctAjaxUrl($url) {
161
-		if ($url !== "/" && JString::endsWith ( $url, "/" ) === true)
162
-			$url = substr ( $url, 0, strlen ( $url ) - 1 );
164
+		if ($url !== "/" && JString::endsWith ( $url, "/" ) === true) {
165
+					$url = substr ( $url, 0, strlen ( $url ) - 1 );
166
+		}
163 167
 		if (strncmp ( $url, 'http://', 7 ) != 0 && strncmp ( $url, 'https://', 8 ) != 0) {
164 168
 			$url = $this->getUrl ( $url );
165 169
 		}
@@ -181,8 +185,9 @@  discard block
 block discarded – undo
181 185
 	public static function _implodeParams($parameters) {
182 186
 		$allParameters = [ ];
183 187
 		foreach ( $parameters as $params ) {
184
-			if (isset ( $params ))
185
-				$allParameters [] = self::_correctParams ( $params );
188
+			if (isset ( $params )) {
189
+							$allParameters [] = self::_correctParams ( $params );
190
+			}
186 191
 		}
187 192
 		return \implode ( "+'&'+", $allParameters );
188 193
 	}
@@ -212,8 +217,9 @@  discard block
 block discarded – undo
212 217
 	}
213 218
 	protected function setDefaultParameters(&$parameters, $default) {
214 219
 		foreach ( $default as $k => $v ) {
215
-			if (! isset ( $parameters [$k] ))
216
-				$parameters [$k] = $v;
220
+			if (! isset ( $parameters [$k] )) {
221
+							$parameters [$k] = $v;
222
+			}
217 223
 		}
218 224
 	}
219 225
 	public function setAjaxLoader($loader) {
@@ -745,8 +751,9 @@  discard block
 block discarded – undo
745 751
 			$retour .= "$('#" . $form . "').submit();\n";
746 752
 		}
747 753
 		$retour = $this->_addJsCondition ( $jsCondition, $retour );
748
-		if ($immediatly)
749
-			$this->jquery_code_for_compile [] = $retour;
754
+		if ($immediatly) {
755
+					$this->jquery_code_for_compile [] = $retour;
756
+		}
750 757
 		return $retour;
751 758
 	}
752 759
 
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.