Passed
Push — master ( 497376...b53e1e )
by Jean-Christophe
02:08
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -89,10 +89,12 @@  discard block
 block discarded – undo
89 89
 					"stopPropagation" => true
90 90
 				]);
91 91
 			}
92
-			if (\is_array($this->_deleteBehavior))
93
-				$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
94
-			if (\is_array($this->_editBehavior))
95
-				$this->_generateBehavior("edit", $this->_editBehavior, $js);
92
+			if (\is_array($this->_deleteBehavior)) {
93
+							$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
94
+			}
95
+			if (\is_array($this->_editBehavior)) {
96
+							$this->_generateBehavior("edit", $this->_editBehavior, $js);
97
+			}
96 98
 			if (\is_array($this->_displayBehavior)) {
97 99
 				$this->_generateBehavior("display", $this->_displayBehavior, $js);
98 100
 			}
@@ -150,8 +152,9 @@  discard block
 block discarded – undo
150 152
 			$table->setRowCount(0, \count($captions));
151 153
 			$this->_generateHeader($table, $captions);
152 154
 
153
-			if (isset($this->_compileParts))
154
-				$table->setCompileParts($this->_compileParts);
155
+			if (isset($this->_compileParts)) {
156
+							$table->setCompileParts($this->_compileParts);
157
+			}
155 158
 
156 159
 			$this->_generateContent($table);
157 160
 
@@ -189,8 +192,9 @@  discard block
 block discarded – undo
189 192
 	}
190 193
 
191 194
 	protected function _applyStyleAttributes($table) {
192
-		if (isset($this->_hiddenColumns))
193
-			$this->_hideColumns();
195
+		if (isset($this->_hiddenColumns)) {
196
+					$this->_hideColumns();
197
+		}
194 198
 		if (isset($this->_colWidths)) {
195 199
 			foreach ($this->_colWidths as $colIndex => $width) {
196 200
 				$table->setColWidth($colIndex, $width);
@@ -303,8 +307,9 @@  discard block
 block discarded – undo
303 307
 			$field = $ck->getField();
304 308
 			$field->setProperty("value", $dataAjax);
305 309
 			$field->setProperty("name", "selection[]");
306
-			if (isset($checkedClass))
307
-				$field->setClass($checkedClass);
310
+			if (isset($checkedClass)) {
311
+							$field->setClass($checkedClass);
312
+			}
308 313
 			\array_unshift($values, $ck);
309 314
 		}
310 315
 		$result = $table->newRow();
@@ -321,8 +326,9 @@  discard block
 block discarded – undo
321 326
 
322 327
 	protected function _generatePagination($table) {
323 328
 		if (isset($this->_toolbar)) {
324
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
325
-				$this->_toolbar->setFloated("left");
329
+			if ($this->_toolbarPosition == PositionInTable::FOOTER) {
330
+							$this->_toolbar->setFloated("left");
331
+			}
326 332
 		}
327 333
 		$footer = $table->getFooter();
328 334
 		$footer->mergeCol();
@@ -364,8 +370,9 @@  discard block
 block discarded – undo
364 370
 
365 371
 	protected function _getFieldName($index) {
366 372
 		$fieldName = parent::_getFieldName($index);
367
-		if (\is_object($fieldName))
368
-			$fieldName = "field-" . $index;
373
+		if (\is_object($fieldName)) {
374
+					$fieldName = "field-" . $index;
375
+		}
369 376
 		if ($this->_namePrefix != null) {
370 377
 			$fieldName = $this->_namePrefix . '.' . $fieldName;
371 378
 		}
@@ -557,8 +564,9 @@  discard block
 block discarded – undo
557 564
 
558 565
 	protected function getTargetSelector($op) {
559 566
 		$result = $this->_targetSelector;
560
-		if (! isset($result[$op]))
561
-			$result = "#" . $this->identifier;
567
+		if (! isset($result[$op])) {
568
+					$result = "#" . $this->identifier;
569
+		}
562 570
 		return $result[$op];
563 571
 	}
564 572
 
@@ -581,8 +589,9 @@  discard block
 block discarded – undo
581 589
 	}
582 590
 
583 591
 	public function getRefreshSelector() {
584
-		if (isset($this->_refreshSelector))
585
-			return $this->_refreshSelector;
592
+		if (isset($this->_refreshSelector)) {
593
+					return $this->_refreshSelector;
594
+		}
586 595
 		return "#" . $this->identifier . " tbody";
587 596
 	}
588 597
 
@@ -603,8 +612,9 @@  discard block
 block discarded – undo
603 612
 	 */
604 613
 	public function show($modelInstance) {
605 614
 		if (\is_array($modelInstance)) {
606
-			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
607
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
615
+			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
616
+							$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
617
+			}
608 618
 		}
609 619
 		$this->_modelInstance = $modelInstance;
610 620
 	}
@@ -654,8 +664,9 @@  discard block
 block discarded – undo
654 664
 	}
655 665
 
656 666
 	public function hideColumn($colIndex) {
657
-		if (! \is_array($this->_hiddenColumns))
658
-			$this->_hiddenColumns = [];
667
+		if (! \is_array($this->_hiddenColumns)) {
668
+					$this->_hiddenColumns = [];
669
+		}
659 670
 		$this->_hiddenColumns[] = $colIndex;
660 671
 		return $this;
661 672
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -444,8 +444,9 @@  discard block
 block discarded – undo
444 444
 			$result = $this->getBody()->_addRow($result);
445 445
 		}
446 446
 		if (isset($this->_afterCompileEvents["onNewRow"])) {
447
-			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
448
-				$this->_afterCompileEvents["onNewRow"]($result, $object);
447
+			if (\is_callable($this->_afterCompileEvents["onNewRow"])) {
448
+							$this->_afterCompileEvents["onNewRow"]($result, $object);
449
+			}
449 450
 		}
450 451
 		return $result;
451 452
 	}
@@ -483,8 +484,9 @@  discard block
 block discarded – undo
483 484
 			}
484 485
 		}
485 486
 		$result = parent::run($js);
486
-		if (isset($this->_footer))
487
-			$this->_footer->run($js);
487
+		if (isset($this->_footer)) {
488
+					$this->_footer->run($js);
489
+		}
488 490
 		$this->_runned = true;
489 491
 		return $result;
490 492
 	}
@@ -538,8 +540,9 @@  discard block
 block discarded – undo
538 540
 
539 541
 	public function setColWidth($colIndex, $width) {
540 542
 		$part = $this->_getFirstPart();
541
-		if ($part !== null && $part->count() > 0)
542
-			$part->getCell(0, $colIndex)->setWidth($width);
543
+		if ($part !== null && $part->count() > 0) {
544
+					$part->getCell(0, $colIndex)->setWidth($width);
545
+		}
543 546
 		return $this;
544 547
 	}
545 548
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTableContent.php 1 patch
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) {
36 36
 		parent::__construct($identifier, $tagName, "");
37
-		if (isset($rowCount) && isset($colCount))
38
-			$this->setRowCount($rowCount, $colCount);
37
+		if (isset($rowCount) && isset($colCount)) {
38
+					$this->setRowCount($rowCount, $colCount);
39
+		}
39 40
 	}
40 41
 
41 42
 	/**
@@ -198,10 +199,11 @@  discard block
 block discarded – undo
198 199
 			$values = \array_fill(0, $count, $values);
199 200
 			$isArray = false;
200 201
 		}
201
-		if (JArray::dimension($values) == 1 && $isArray)
202
-			$values = [
202
+		if (JArray::dimension($values) == 1 && $isArray) {
203
+					$values = [
203 204
 				$values
204 205
 			];
206
+		}
205 207
 
206 208
 		$count = \min(\sizeof($values), $count);
207 209
 
@@ -228,8 +230,9 @@  discard block
 block discarded – undo
228 230
 		$count = $this->count();
229 231
 		for ($i = 0; $i < $count; $i ++) {
230 232
 			$cell = $this->getCell($i, $colIndex);
231
-			if ($cell instanceof BaseTrait)
232
-				$cell->addVariations($variations);
233
+			if ($cell instanceof BaseTrait) {
234
+							$cell->addVariations($variations);
235
+			}
233 236
 		}
234 237
 		return $this;
235 238
 	}
@@ -238,8 +241,9 @@  discard block
 block discarded – undo
238 241
 		$count = $this->count();
239 242
 		for ($i = 0; $i < $count; $i ++) {
240 243
 			$cell = $this->getCell($i, $colIndex);
241
-			if (isset($cell))
242
-				$cell->addToProperty($name, $value);
244
+			if (isset($cell)) {
245
+							$cell->addToProperty($name, $value);
246
+			}
243 247
 		}
244 248
 		return $this;
245 249
 	}
@@ -273,8 +277,9 @@  discard block
 block discarded – undo
273 277
 			$maxRow = $this->content[$i]->count();
274 278
 			$index = $maxRow - $colIndex - 1;
275 279
 			if (($cell = $this->getCell($i, $index)) !== NULL) {
276
-				if ($cell->getColspan() == 1)
277
-					$cell->$function();
280
+				if ($cell->getColspan() == 1) {
281
+									$cell->$function();
282
+				}
278 283
 			}
279 284
 		}
280 285
 		return $this;
@@ -320,8 +325,9 @@  discard block
 block discarded – undo
320 325
 	 */
321 326
 	public function getColCount() {
322 327
 		$result = 0;
323
-		if ($this->count() > 0)
324
-			$result = $this->getItem(0)->count();
328
+		if ($this->count() > 0) {
329
+					$result = $this->getItem(0)->count();
330
+		}
325 331
 		return $result;
326 332
 	}
327 333
 
@@ -346,15 +352,17 @@  discard block
 block discarded – undo
346 352
 
347 353
 	public function toDelete($rowIndex, $colIndex) {
348 354
 		$row = $this->getItem($rowIndex);
349
-		if (isset($row) === true)
350
-			$row->toDelete($colIndex);
355
+		if (isset($row) === true) {
356
+					$row->toDelete($colIndex);
357
+		}
351 358
 		return $this;
352 359
 	}
353 360
 
354 361
 	public function toRowspanned($rowIndex, $colIndex) {
355 362
 		$row = $this->getItem($rowIndex);
356
-		if (isset($row) === true)
357
-			$row->toRowspanned($colIndex);
363
+		if (isset($row) === true) {
364
+					$row->toRowspanned($colIndex);
365
+		}
358 366
 		return $this;
359 367
 	}
360 368
 
@@ -464,8 +472,9 @@  discard block
 block discarded – undo
464 472
 		foreach ($rows as $row) {
465 473
 			$cell = $row->getItem($colIndex);
466 474
 			$value = $cell->getContent();
467
-			if ($functionExists)
468
-				$value = \call_user_func($function, $value);
475
+			if ($functionExists) {
476
+							$value = \call_user_func($function, $value);
477
+			}
469 478
 			if ($value !== $identiqual) {
470 479
 				if ($counter > 0 && isset($cellToMerge)) {
471 480
 					$cellToMerge->setRowspanned($counter);
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormInput.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,16 +14,18 @@
 block discarded – undo
14 14
 	const TOGGLE_INTERVAL = 2;
15 15
 
16 16
 	public function __construct($identifier, $label = NULL, $type = "text", $value = NULL, $placeholder = NULL) {
17
-		if (! isset($placeholder) && $type === "text")
18
-			$placeholder = $label;
17
+		if (! isset($placeholder) && $type === "text") {
18
+					$placeholder = $label;
19
+		}
19 20
 		parent::__construct("field-" . $identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
20 21
 		$this->_identifier = $identifier;
21 22
 	}
22 23
 
23 24
 	public function getDataField() {
24 25
 		$field = $this->getField();
25
-		if ($field instanceof HtmlInput)
26
-			$field = $field->getDataField();
26
+		if ($field instanceof HtmlInput) {
27
+					$field = $field->getDataField();
28
+		}
27 29
 		return $field;
28 30
 	}
29 31
 
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -112,15 +112,18 @@  discard block
 block discarded – undo
112 112
 			$flag = false;
113 113
 			$index = 0;
114 114
 			while (! $flag && $index < sizeof($elements)) {
115
-				if ($elements[$index] instanceof BaseHtml)
116
-					$flag = ($callback($elements[$index]));
115
+				if ($elements[$index] instanceof BaseHtml) {
116
+									$flag = ($callback($elements[$index]));
117
+				}
117 118
 				$index ++;
118 119
 			}
119
-			if ($flag === true)
120
-				return $elements[$index - 1];
120
+			if ($flag === true) {
121
+							return $elements[$index - 1];
122
+			}
121 123
 		} elseif ($elements instanceof BaseHtml) {
122
-			if ($callback($elements))
123
-				return $elements;
124
+			if ($callback($elements)) {
125
+							return $elements;
126
+			}
124 127
 		}
125 128
 		return null;
126 129
 	}
@@ -146,8 +149,9 @@  discard block
 block discarded – undo
146 149
 
147 150
 	public function fromArray($array) {
148 151
 		foreach ($this as $key => $value) {
149
-			if (array_key_exists($key, $array) === true)
150
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
152
+			if (array_key_exists($key, $array) === true) {
153
+							$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
154
+			}
151 155
 		}
152 156
 		foreach ($array as $key => $value) {
153 157
 			if ($this->_callSetter($key, $key, $value, $array) === false) {
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Braces   +18 added lines, -13 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		if (isset($partial)) {
68 68
 			$ajaxParameters["xhr"] = "xhrProvider";
69 69
 			$retour .= "var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.onreadystatechange = function (e) { if (3==e.target.readyState){let response=e.target.responseText;" . $partial . ";}; };";
70
-		}elseif (isset($upload)) {
70
+		} elseif (isset($upload)) {
71 71
 			$ajaxParameters["xhr"] = "xhrProvider";
72 72
 			$retour .= 'var xhr = $.ajaxSettings.xhr();function xhrProvider() {return xhr;};xhr.upload.addEventListener("progress", function(event) {if (event.lengthComputable) {'.$upload.'}}, false);';
73 73
 		}
@@ -165,10 +165,11 @@  discard block
 block discarded – undo
165 165
 			} elseif (isset($this->ajaxTransition)) {
166 166
 				$call = $this->ajaxTransition;
167 167
 			}
168
-			if (\is_callable($call))
169
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
170
-			else
171
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
168
+			if (\is_callable($call)) {
169
+							$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
170
+			} else {
171
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
172
+			}
172 173
 		}
173 174
 		if (isset($history)) {
174 175
 			if ($this->params["autoActiveLinks"]) {
@@ -208,8 +209,9 @@  discard block
 block discarded – undo
208 209
 	}
209 210
 
210 211
 	protected function _correctAjaxUrl($url) {
211
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
212
-			$url = substr($url, 0, strlen($url) - 1);
212
+		if ($url !== "/" && JString::endsWith($url, "/") === true) {
213
+					$url = substr($url, 0, strlen($url) - 1);
214
+		}
213 215
 		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
214 216
 			$url = $this->getUrl($url);
215 217
 		}
@@ -233,8 +235,9 @@  discard block
 block discarded – undo
233 235
 	public static function _implodeParams($parameters) {
234 236
 		$allParameters = [];
235 237
 		foreach ($parameters as $params) {
236
-			if (isset($params))
237
-				$allParameters[] = self::_correctParams($params);
238
+			if (isset($params)) {
239
+							$allParameters[] = self::_correctParams($params);
240
+			}
238 241
 		}
239 242
 		return \implode("+'&'+", $allParameters);
240 243
 	}
@@ -268,8 +271,9 @@  discard block
 block discarded – undo
268 271
 
269 272
 	protected function setDefaultParameters(&$parameters, $default) {
270 273
 		foreach ($default as $k => $v) {
271
-			if (! isset($parameters[$k]))
272
-				$parameters[$k] = $v;
274
+			if (! isset($parameters[$k])) {
275
+							$parameters[$k] = $v;
276
+			}
273 277
 		}
274 278
 	}
275 279
 
@@ -844,8 +848,9 @@  discard block
 block discarded – undo
844 848
 			$retour .= "$('#'+" . $form . ").submit();\n";
845 849
 		}
846 850
 		$retour = $this->_addJsCondition($jsCondition, $retour);
847
-		if ($immediatly)
848
-			$this->jquery_code_for_compile[] = $retour;
851
+		if ($immediatly) {
852
+					$this->jquery_code_for_compile[] = $retour;
853
+		}
849 854
 		return $retour;
850 855
 	}
851 856
 
Please login to merge, or discard this patch.