Passed
Push — master ( b5945e...160666 )
by Jean-Christophe
02:42
created
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +29 added lines, -24 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);
@@ -264,7 +266,7 @@  discard block
 block discarded – undo
264 266
 					$this->setInstanceProperty($property);
265 267
 				}
266 268
 			}
267
-		}catch (\Throwable $th){
269
+		} catch (\Throwable $th){
268 270
 			
269 271
 		}
270 272
 		return $this;
@@ -284,10 +286,11 @@  discard block
 block discarded – undo
284 286
 			}
285 287
 		} elseif (\is_int($property)) {
286 288
 			$props = $this->getDefaultProperties();
287
-			if (isset($props[$property]))
288
-				$this->properties[] = $props[$property];
289
-			else
290
-				$this->properties[] = $property;
289
+			if (isset($props[$property])) {
290
+							$this->properties[] = $props[$property];
291
+			} else {
292
+							$this->properties[] = $property;
293
+			}
291 294
 		} else {
292 295
 			$this->properties[] = $property;
293 296
 		}
@@ -332,12 +335,13 @@  discard block
 block discarded – undo
332 335
 		if (isset($this->captions[$index])) {
333 336
 			return $this->captions[$index];
334 337
 		}
335
-		if ($this->properties[$index] instanceof \ReflectionProperty)
336
-			return $this->properties[$index]->getName();
337
-		elseif (\is_callable($this->properties[$index]))
338
-			return "";
339
-		else
340
-			return $this->properties[$index];
338
+		if ($this->properties[$index] instanceof \ReflectionProperty) {
339
+					return $this->properties[$index]->getName();
340
+		} elseif (\is_callable($this->properties[$index])) {
341
+					return "";
342
+		} else {
343
+					return $this->properties[$index];
344
+		}
341 345
 	}
342 346
 
343 347
 	public function getCaptions() {
@@ -370,8 +374,9 @@  discard block
 block discarded – undo
370 374
 	}
371 375
 
372 376
 	public function setCaption($index, $caption) {
373
-		if (isset($this->captions) === false)
374
-			$this->captions = [];
377
+		if (isset($this->captions) === false) {
378
+					$this->captions = [];
379
+		}
375 380
 		$this->captions[$index] = $caption;
376 381
 		return $this;
377 382
 	}
Please login to merge, or discard this patch.
Ajax/common/BaseEnum.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@
 block discarded – undo
27 27
 	}
28 28
 
29 29
 	public static function getConstantValues($postFix = "", $prefixBefore = false) {
30
-		if ($postFix == "")
31
-			return \array_values(self::getConstants());
32
-		else {
30
+		if ($postFix == "") {
31
+					return \array_values(self::getConstants());
32
+		} else {
33 33
 			if ($prefixBefore === false) {
34 34
 				return \array_map(function ($elem) use ($postFix) {
35 35
 					return $elem . " " . $postFix;
Please login to merge, or discard this patch.
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/common/traits/JsUtilsAjaxTrait.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -161,10 +161,11 @@  discard block
 block discarded – undo
161 161
 			} elseif (isset($this->ajaxTransition)) {
162 162
 				$call = $this->ajaxTransition;
163 163
 			}
164
-			if (\is_callable($call))
165
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
166
-			else
167
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
164
+			if (\is_callable($call)) {
165
+							$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
166
+			} else {
167
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
168
+			}
168 169
 		}
169 170
 		if (isset($history)) {
170 171
 			if ($this->params["autoActiveLinks"]) {
@@ -198,8 +199,9 @@  discard block
 block discarded – undo
198 199
 	}
199 200
 
200 201
 	protected function _correctAjaxUrl($url) {
201
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
202
-			$url = substr($url, 0, strlen($url) - 1);
202
+		if ($url !== "/" && JString::endsWith($url, "/") === true) {
203
+					$url = substr($url, 0, strlen($url) - 1);
204
+		}
203 205
 		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
204 206
 			$url = $this->getUrl($url);
205 207
 		}
@@ -223,8 +225,9 @@  discard block
 block discarded – undo
223 225
 	public static function _implodeParams($parameters) {
224 226
 		$allParameters = [];
225 227
 		foreach ($parameters as $params) {
226
-			if (isset($params))
227
-				$allParameters[] = self::_correctParams($params);
228
+			if (isset($params)) {
229
+							$allParameters[] = self::_correctParams($params);
230
+			}
228 231
 		}
229 232
 		return \implode("+'&'+", $allParameters);
230 233
 	}
@@ -258,8 +261,9 @@  discard block
 block discarded – undo
258 261
 
259 262
 	protected function setDefaultParameters(&$parameters, $default) {
260 263
 		foreach ($default as $k => $v) {
261
-			if (! isset($parameters[$k]))
262
-				$parameters[$k] = $v;
264
+			if (! isset($parameters[$k])) {
265
+							$parameters[$k] = $v;
266
+			}
263 267
 		}
264 268
 	}
265 269
 
@@ -833,8 +837,9 @@  discard block
 block discarded – undo
833 837
 			$retour .= "$('#'+" . $form . ").submit();\n";
834 838
 		}
835 839
 		$retour = $this->_addJsCondition($jsCondition, $retour);
836
-		if ($immediatly)
837
-			$this->jquery_code_for_compile[] = $retour;
840
+		if ($immediatly) {
841
+					$this->jquery_code_for_compile[] = $retour;
842
+		}
838 843
 		return $retour;
839 844
 	}
840 845
 
Please login to merge, or discard this patch.