Passed
Push — master ( 42337f...468e47 )
by Jean-Christophe
02:24
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +38 added lines, -26 removed lines patch added patch discarded remove patch
@@ -58,18 +58,21 @@  discard block
 block discarded – undo
58 58
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
59 59
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
60 60
 		}
61
-		if(\is_array($this->_deleteBehavior))
62
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
63
-		if(\is_array($this->_editBehavior))
64
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
61
+		if(\is_array($this->_deleteBehavior)) {
62
+					$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
63
+		}
64
+		if(\is_array($this->_editBehavior)) {
65
+					$this->_generateBehavior("edit",$this->_editBehavior,$js);
66
+		}
65 67
 		if(\is_array($this->_displayBehavior)){
66 68
 			$this->_displayBehavior["jsCallback"]='$("#dataTable").hide();';
67 69
 			$this->_generateBehavior("display",$this->_displayBehavior,$js);
68 70
 		}
69 71
 		parent::run($js);
70 72
 		$this->_associateSearchFieldBehavior($js,$offset);
71
-		if(isset($this->_pagination))
72
-			$this->_associatePaginationBehavior($js,$offset);
73
+		if(isset($this->_pagination)) {
74
+					$this->_associatePaginationBehavior($js,$offset);
75
+		}
73 76
 	}
74 77
 
75 78
 	protected function _generateBehavior($op,$params,JsUtils $js){
@@ -102,8 +105,9 @@  discard block
 block discarded – undo
102 105
 			$table->setRowCount(0, \sizeof($captions));
103 106
 			$this->_generateHeader($table,$captions);
104 107
 
105
-			if(isset($this->_compileParts))
106
-				$table->setCompileParts($this->_compileParts);
108
+			if(isset($this->_compileParts)) {
109
+							$table->setCompileParts($this->_compileParts);
110
+			}
107 111
 
108 112
 			$this->_generateContent($table);
109 113
 
@@ -133,8 +137,9 @@  discard block
 block discarded – undo
133 137
 	}
134 138
 
135 139
 	protected function _applyStyleAttributes($table){
136
-		if(isset($this->_hiddenColumns))
137
-			$this->_hideColumns();
140
+		if(isset($this->_hiddenColumns)) {
141
+					$this->_hideColumns();
142
+		}
138 143
 			if(isset($this->_colWidths)){
139 144
 				foreach ($this->_colWidths as $colIndex=>$width){
140 145
 					$table->setColWidth($colIndex,$width);
@@ -193,8 +198,9 @@  discard block
 block discarded – undo
193 198
 			$field=$ck->getField();
194 199
 			$field->setProperty("value",$dataAjax);
195 200
 			$field->setProperty("name", "selection[]");
196
-			if(isset($checkedClass))
197
-				$field->setClass($checkedClass);
201
+			if(isset($checkedClass)) {
202
+							$field->setClass($checkedClass);
203
+			}
198 204
 			\array_unshift($values, $ck);
199 205
 		}
200 206
 		$result=$table->newRow();
@@ -207,8 +213,9 @@  discard block
 block discarded – undo
207 213
 
208 214
 	protected function _generatePagination($table,$js=NULL){
209 215
 		if(isset($this->_toolbar)){
210
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
211
-				$this->_toolbar->setFloated("left");
216
+			if($this->_toolbarPosition==PositionInTable::FOOTER) {
217
+							$this->_toolbar->setFloated("left");
218
+			}
212 219
 		}
213 220
 		$footer=$table->getFooter();
214 221
 		$footer->mergeCol();
@@ -232,8 +239,9 @@  discard block
 block discarded – undo
232 239
 
233 240
 	protected function _getFieldName($index){
234 241
 		$fieldName=parent::_getFieldName($index);
235
-		if(\is_object($fieldName))
236
-			$fieldName="field-".$index;
242
+		if(\is_object($fieldName)) {
243
+					$fieldName="field-".$index;
244
+		}
237 245
 		return $fieldName."[]";
238 246
 	}
239 247
 
@@ -273,7 +281,7 @@  discard block
 block discarded – undo
273 281
 		$hasPart=$table->hasPart($part);
274 282
 		if($hasPart){
275 283
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
276
-		}else{
284
+		} else{
277 285
 			$row=$table->getPart($part)->getRow(0);
278 286
 		}
279 287
 		$row->mergeCol();
@@ -305,7 +313,7 @@  discard block
 block discarded – undo
305 313
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
306 314
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
307 315
 			$this->_urls["display"]=JArray::getValue($urls, "display",3);
308
-		}else{
316
+		} else{
309 317
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls,"display"=>$urls];
310 318
 		}
311 319
 		return $this;
@@ -388,8 +396,9 @@  discard block
 block discarded – undo
388 396
 
389 397
 	protected function getTargetSelector($op) {
390 398
 		$result=$this->_targetSelector;
391
-		if(!isset($result[$op]))
392
-			$result="#".$this->identifier;
399
+		if(!isset($result[$op])) {
400
+					$result="#".$this->identifier;
401
+		}
393 402
 		return $result[$op];
394 403
 	}
395 404
 
@@ -407,8 +416,9 @@  discard block
 block discarded – undo
407 416
 	}
408 417
 
409 418
 	public function getRefreshSelector() {
410
-		if(isset($this->_refreshSelector))
411
-			return $this->_refreshSelector;
419
+		if(isset($this->_refreshSelector)) {
420
+					return $this->_refreshSelector;
421
+		}
412 422
 		return "#".$this->identifier." tbody";
413 423
 	}
414 424
 
@@ -427,8 +437,9 @@  discard block
 block discarded – undo
427 437
 	 */
428 438
 	public function show($modelInstance){
429 439
 		if(\is_array($modelInstance)){
430
-			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
431
-				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
440
+			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
441
+							$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
442
+			}
432 443
 		}
433 444
 		$this->_modelInstance=$modelInstance;
434 445
 	}
@@ -468,8 +479,9 @@  discard block
 block discarded – undo
468 479
 	}
469 480
 
470 481
 	public function hideColumn($colIndex){
471
-		if(!\is_array($this->_hiddenColumns))
472
-			$this->_hiddenColumns=[];
482
+		if(!\is_array($this->_hiddenColumns)) {
483
+					$this->_hiddenColumns=[];
484
+		}
473 485
 		$this->_hiddenColumns[]=$colIndex;
474 486
 		return $this;
475 487
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +46 added lines, -40 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 		$this->widgetIdentifier=$identifier;
24 24
 		$this->values=[];
25 25
 		$this->afterCompile=[];
26
-		if(isset($instance))
27
-			$this->setInstance($instance);
26
+		if(isset($instance)) {
27
+					$this->setInstance($instance);
28
+		}
28 29
 		$this->setCaptions($captions);
29 30
 		$this->captionCallback=NULL;
30 31
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -62,14 +63,16 @@  discard block
 block discarded – undo
62 63
 	}
63 64
 
64 65
 	public function getIdentifier($index=NULL){
65
-		if(!isset($index))
66
-			$index=self::$index;
66
+		if(!isset($index)) {
67
+					$index=self::$index;
68
+		}
67 69
 		$value=$index;
68 70
 		if(isset($this->values["identifier"])){
69
-			if(\is_string($this->values["identifier"]))
70
-				$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
71
-			else
72
-				$value=$this->values["identifier"]($index,$this->instance);
71
+			if(\is_string($this->values["identifier"])) {
72
+							$value=JReflection::callMethod($this->instance, $this->values["identifier"], []);
73
+			} else {
74
+							$value=$this->values["identifier"]($index,$this->instance);
75
+			}
73 76
 		}
74 77
 		return $value;
75 78
 	}
@@ -99,16 +102,16 @@  discard block
 block discarded – undo
99 102
 		if($property instanceof \ReflectionProperty){
100 103
 			$value=$this->_getPropertyValue($property);
101 104
 			$propertyName=$property->getName();
102
-		}elseif(\is_callable($property) && array_search($property, ["system"])===false)
103
-			$value=$property($this->instance);
104
-		elseif(\is_array($property)){
105
+		} elseif(\is_callable($property) && array_search($property, ["system"])===false) {
106
+					$value=$property($this->instance);
107
+		} elseif(\is_array($property)){
105 108
 			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
106 109
 			$value=\implode("", $values);
107
-		}elseif(\is_string($property)){
110
+		} elseif(\is_string($property)){
108 111
 			$value=$property;
109 112
 			if(isset($this->instance->{$property})){
110 113
 				$value=$this->instance->{$property};
111
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
114
+			} elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
112 115
 				$value=JReflection::callMethod($this->instance, $getter, []);
113 116
 			}
114 117
 		}
@@ -118,7 +121,7 @@  discard block
 block discarded – undo
118 121
 	protected function _postGetValue($index,$propertyName,$value){
119 122
 		if(isset($this->values[$index])){
120 123
 			$value= $this->values[$index]($value,$this->instance,$index,self::$index);
121
-		}else{
124
+		} else{
122 125
 			$value=$this->_getDefaultValue($propertyName,$value, $index);
123 126
 		}
124 127
 		if(isset($this->afterCompile[$index])){
@@ -132,7 +135,7 @@  discard block
 block discarded – undo
132 135
 	public function insertField($index,$field,$key=null){
133 136
 		if(isset($key)){
134 137
 			array_splice( $this->visibleProperties, $index, 0, [$key=>$field] );
135
-		}else{
138
+		} else{
136 139
 			array_splice( $this->visibleProperties, $index, 0, $field );
137 140
 		}
138 141
 		return $this;
@@ -153,17 +156,17 @@  discard block
 block discarded – undo
153 156
 			if(isset($key)){
154 157
 				if(\is_array($vb[$index])){
155 158
 					$this->visibleProperties[$index][$key]=$field;
156
-				}else{
159
+				} else{
157 160
 					$this->visibleProperties[$index]=[$vb[$index],$key=>$field];
158 161
 				}
159
-			}else{
162
+			} else{
160 163
 				if(\is_array($vb[$index])){
161 164
 					$this->visibleProperties[$index][]=$field;
162
-				}else{
165
+				} else{
163 166
 					$this->visibleProperties[$index]=[$vb[$index],$field];
164 167
 				}
165 168
 			}
166
-		}else{
169
+		} else{
167 170
 			return $this->insertField($index, $field);
168 171
 		}
169 172
 		return $this;
@@ -172,7 +175,7 @@  discard block
 block discarded – undo
172 175
 	public function addField($field,$key=null){
173 176
 		if(isset($key)){
174 177
 			$this->visibleProperties[]=[$key=>$field];
175
-		}else{
178
+		} else{
176 179
 			$this->visibleProperties[]=$field;
177 180
 		}
178 181
 		return $this;
@@ -199,9 +202,9 @@  discard block
 block discarded – undo
199 202
 		$property=$this->getProperty($index);
200 203
 		if($property instanceof \ReflectionProperty){
201 204
 			$result=$property->getName();
202
-		}elseif(\is_callable($property)){
205
+		} elseif(\is_callable($property)){
203 206
 			$result=$this->visibleProperties[$index];
204
-		}else{
207
+		} else{
205 208
 			$result=$property;
206 209
 		}
207 210
 		return $result;
@@ -221,7 +224,7 @@  discard block
 block discarded – undo
221 224
 		$this->reflect=new \ReflectionClass($instance);
222 225
 		if(JArray::count($this->visibleProperties)===0){
223 226
 			$this->properties=$this->getDefaultProperties();
224
-		}else{
227
+		} else{
225 228
 			foreach ($this->visibleProperties as $property){
226 229
 				$this->setInstanceProperty($property);
227 230
 			}
@@ -232,22 +235,23 @@  discard block
 block discarded – undo
232 235
 	private function setInstanceProperty($property){
233 236
 		if(\is_callable($property)){
234 237
 			$this->properties[]=$property;
235
-		}elseif(\is_string($property)){
238
+		} elseif(\is_string($property)){
236 239
 			try{
237 240
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
238 241
 				$rProperty=$this->reflect->getProperty($property);
239 242
 				$this->properties[]=$rProperty;
240
-			}catch(\Exception $e){
243
+			} catch(\Exception $e){
241 244
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
242 245
 				$this->properties[]=$property;
243 246
 			}
244
-		}elseif(\is_int($property)){
247
+		} elseif(\is_int($property)){
245 248
 			$props=$this->getDefaultProperties();
246
-			if(isset($props[$property]))
247
-				$this->properties[]=$props[$property];
248
-				else
249
-					$this->properties[]=$property;
250
-		}else{
249
+			if(isset($props[$property])) {
250
+							$this->properties[]=$props[$property];
251
+			} else {
252
+									$this->properties[]=$property;
253
+				}
254
+		} else{
251 255
 			$this->properties[]=$property;
252 256
 		}
253 257
 	}
@@ -291,12 +295,13 @@  discard block
 block discarded – undo
291 295
 		if(isset($this->captions[$index])){
292 296
 			return $this->captions[$index];
293 297
 		}
294
-		if($this->properties[$index] instanceof \ReflectionProperty)
295
-			return $this->properties[$index]->getName();
296
-		elseif(\is_callable($this->properties[$index]))
297
-			return "";
298
-		else
299
-			return $this->properties[$index];
298
+		if($this->properties[$index] instanceof \ReflectionProperty) {
299
+					return $this->properties[$index]->getName();
300
+		} elseif(\is_callable($this->properties[$index])) {
301
+					return "";
302
+		} else {
303
+					return $this->properties[$index];
304
+		}
300 305
 	}
301 306
 
302 307
 	public function getCaptions(){
@@ -307,7 +312,7 @@  discard block
 block discarded – undo
307 312
 			for($i=$captionsSize;$i<$count;$i++){
308 313
 				$captions[]="";
309 314
 			}
310
-		}else{
315
+		} else{
311 316
 			$captions=[];
312 317
 			$index=0;
313 318
 			while($index<$count){
@@ -322,8 +327,9 @@  discard block
 block discarded – undo
322 327
 	}
323 328
 
324 329
 	public function setCaption($index,$caption){
325
-		if(isset($this->captions)===false)
326
-			$this->captions=[];
330
+		if(isset($this->captions)===false) {
331
+					$this->captions=[];
332
+		}
327 333
 		$this->captions[$index]=$caption;
328 334
 		return $this;
329 335
 	}
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
@@ -345,8 +345,9 @@  discard block
 block discarded – undo
345 345
 			$result= $this->getBody()->_addRow($result);
346 346
 		}
347 347
 		if(isset($this->_afterCompileEvents["onNewRow"])){
348
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
349
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
348
+			if(\is_callable($this->_afterCompileEvents["onNewRow"])) {
349
+							$this->_afterCompileEvents["onNewRow"]($result,$object);
350
+			}
350 351
 		}
351 352
 		return $result;
352 353
 	}
@@ -374,8 +375,9 @@  discard block
 block discarded – undo
374 375
 			$this->_activeRowSelector->run();
375 376
 		}
376 377
 		$result= parent::run($js);
377
-		if(isset($this->_footer))
378
-			$this->_footer->run($js);
378
+		if(isset($this->_footer)) {
379
+					$this->_footer->run($js);
380
+		}
379 381
 		return $result;
380 382
 	}
381 383
 
@@ -415,8 +417,9 @@  discard block
 block discarded – undo
415 417
 
416 418
 	public function setColWidth($colIndex,$width){
417 419
 		$part=$this->_getFirstPart();
418
-		if($part!==null && $part->count()>0)
419
-			$part->getCell(0, $colIndex)->setWidth($width);
420
+		if($part!==null && $part->count()>0) {
421
+					$part->getCell(0, $colIndex)->setWidth($width);
422
+		}
420 423
 		return $this;
421 424
 	}
422 425
 
Please login to merge, or discard this patch.