Passed
Push — master ( 09c8f4...92ec9e )
by Jean-Christophe
02:15
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();
@@ -363,8 +369,9 @@  discard block
 block discarded – undo
363 369
 
364 370
 	protected function _getFieldName($index) {
365 371
 		$fieldName = parent::_getFieldName($index);
366
-		if (\is_object($fieldName))
367
-			$fieldName = "field-" . $index;
372
+		if (\is_object($fieldName)) {
373
+					$fieldName = "field-" . $index;
374
+		}
368 375
 		if($this->_namePrefix!=null){
369 376
 			$fieldName=$this->_namePrefix.'.'.$fieldName;
370 377
 		}
@@ -556,8 +563,9 @@  discard block
 block discarded – undo
556 563
 
557 564
 	protected function getTargetSelector($op) {
558 565
 		$result = $this->_targetSelector;
559
-		if (! isset($result[$op]))
560
-			$result = "#" . $this->identifier;
566
+		if (! isset($result[$op])) {
567
+					$result = "#" . $this->identifier;
568
+		}
561 569
 		return $result[$op];
562 570
 	}
563 571
 
@@ -580,8 +588,9 @@  discard block
 block discarded – undo
580 588
 	}
581 589
 
582 590
 	public function getRefreshSelector() {
583
-		if (isset($this->_refreshSelector))
584
-			return $this->_refreshSelector;
591
+		if (isset($this->_refreshSelector)) {
592
+					return $this->_refreshSelector;
593
+		}
585 594
 		return "#" . $this->identifier . " tbody";
586 595
 	}
587 596
 
@@ -602,8 +611,9 @@  discard block
 block discarded – undo
602 611
 	 */
603 612
 	public function show($modelInstance) {
604 613
 		if (\is_array($modelInstance)) {
605
-			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
606
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
614
+			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
615
+							$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
616
+			}
607 617
 		}
608 618
 		$this->_modelInstance = $modelInstance;
609 619
 	}
@@ -649,8 +659,9 @@  discard block
 block discarded – undo
649 659
 	}
650 660
 
651 661
 	public function hideColumn($colIndex) {
652
-		if (! \is_array($this->_hiddenColumns))
653
-			$this->_hiddenColumns = [];
662
+		if (! \is_array($this->_hiddenColumns)) {
663
+					$this->_hiddenColumns = [];
664
+		}
654 665
 		$this->_hiddenColumns[] = $colIndex;
655 666
 		return $this;
656 667
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -68,15 +68,17 @@  discard block
 block discarded – undo
68 68
 	private function getFieldButton($caption,$visibleHover=true,$icon=null){
69 69
 		$id=$this->_instanceViewer->getIdentifier();
70 70
 		$bt= new HtmlButton($this->cleanIdentifier($icon??$caption).'-'.$id,$caption);
71
-		if($visibleHover)
72
-			$this->_visibleOver($bt);
71
+		if($visibleHover) {
72
+					$this->_visibleOver($bt);
73
+		}
73 74
 		return $bt;
74 75
 	}
75 76
 
76 77
 	private function getFieldButtons($buttons,$visibleHover=true){
77 78
 		$bts=new HtmlButtonGroups("",$buttons);
78
-		if($visibleHover)
79
-			$this->_visibleOver($bts);
79
+		if($visibleHover) {
80
+					$this->_visibleOver($bts);
81
+		}
80 82
 		return $bts;
81 83
 	}
82 84
 
@@ -93,8 +95,9 @@  discard block
 block discarded – undo
93 95
 		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
94 96
 			$button=new HtmlButton($id,$value,$cssStyle);
95 97
 			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
96
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
97
-				$this->_visibleOver($button);
98
+			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"]) {
99
+							$this->_visibleOver($button);
100
+			}
98 101
 				return $button;
99 102
 		}, $index,$attributes);
100 103
 	}
@@ -165,8 +168,9 @@  discard block
 block discarded – undo
165 168
 	private function getDefaultButton($icon,$class=null,$visibleHover=true){
166 169
 		$bt=$this->getFieldButton("",$visibleHover,$icon);
167 170
 		$bt->asIcon($icon);
168
-		if(isset($class))
169
-			$bt->addClass($class);
171
+		if(isset($class)) {
172
+					$bt->addClass($class);
173
+		}
170 174
 		return $bt;
171 175
 	}
172 176
 
Please login to merge, or discard this patch.
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.