Passed
Push — master ( 87a0c2...5d3f7c )
by Jean-Christophe
02:59
created
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +36 added lines, -24 removed lines patch added patch discarded remove patch
@@ -81,16 +81,19 @@  discard block
 block discarded – undo
81 81
 				"stopPropagation" => true
82 82
 			]);
83 83
 		}
84
-		if (\is_array($this->_deleteBehavior))
85
-			$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
86
-		if (\is_array($this->_editBehavior))
87
-			$this->_generateBehavior("edit", $this->_editBehavior, $js);
84
+		if (\is_array($this->_deleteBehavior)) {
85
+					$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
86
+		}
87
+		if (\is_array($this->_editBehavior)) {
88
+					$this->_generateBehavior("edit", $this->_editBehavior, $js);
89
+		}
88 90
 		if (\is_array($this->_displayBehavior)) {
89 91
 			$this->_generateBehavior("display", $this->_displayBehavior, $js);
90 92
 		}
91 93
 		parent::run($js);
92
-		if (isset($this->_pagination))
93
-			$this->_associatePaginationBehavior($js, $offset);
94
+		if (isset($this->_pagination)) {
95
+					$this->_associatePaginationBehavior($js, $offset);
96
+		}
94 97
 		$this->_associateSearchFieldBehavior($js, $offset);
95 98
 	}
96 99
 
@@ -139,8 +142,9 @@  discard block
 block discarded – undo
139 142
 			$table->setRowCount(0, \sizeof($captions));
140 143
 			$this->_generateHeader($table, $captions);
141 144
 
142
-			if (isset($this->_compileParts))
143
-				$table->setCompileParts($this->_compileParts);
145
+			if (isset($this->_compileParts)) {
146
+							$table->setCompileParts($this->_compileParts);
147
+			}
144 148
 
145 149
 			$this->_generateContent($table);
146 150
 
@@ -175,8 +179,9 @@  discard block
 block discarded – undo
175 179
 	}
176 180
 
177 181
 	protected function _applyStyleAttributes($table) {
178
-		if (isset($this->_hiddenColumns))
179
-			$this->_hideColumns();
182
+		if (isset($this->_hiddenColumns)) {
183
+					$this->_hideColumns();
184
+		}
180 185
 		if (isset($this->_colWidths)) {
181 186
 			foreach ($this->_colWidths as $colIndex => $width) {
182 187
 				$table->setColWidth($colIndex, $width);
@@ -285,8 +290,9 @@  discard block
 block discarded – undo
285 290
 			$field = $ck->getField();
286 291
 			$field->setProperty("value", $dataAjax);
287 292
 			$field->setProperty("name", "selection[]");
288
-			if (isset($checkedClass))
289
-				$field->setClass($checkedClass);
293
+			if (isset($checkedClass)) {
294
+							$field->setClass($checkedClass);
295
+			}
290 296
 			\array_unshift($values, $ck);
291 297
 		}
292 298
 		$result = $table->newRow();
@@ -303,8 +309,9 @@  discard block
 block discarded – undo
303 309
 
304 310
 	protected function _generatePagination($table) {
305 311
 		if (isset($this->_toolbar)) {
306
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
307
-				$this->_toolbar->setFloated("left");
312
+			if ($this->_toolbarPosition == PositionInTable::FOOTER) {
313
+							$this->_toolbar->setFloated("left");
314
+			}
308 315
 		}
309 316
 		$footer = $table->getFooter();
310 317
 		$footer->mergeCol();
@@ -344,8 +351,9 @@  discard block
 block discarded – undo
344 351
 
345 352
 	protected function _getFieldName($index) {
346 353
 		$fieldName = parent::_getFieldName($index);
347
-		if (\is_object($fieldName))
348
-			$fieldName = "field-" . $index;
354
+		if (\is_object($fieldName)) {
355
+					$fieldName = "field-" . $index;
356
+		}
349 357
 		return $fieldName . "[]";
350 358
 	}
351 359
 
@@ -522,8 +530,9 @@  discard block
 block discarded – undo
522 530
 
523 531
 	protected function getTargetSelector($op) {
524 532
 		$result = $this->_targetSelector;
525
-		if (! isset($result[$op]))
526
-			$result = "#" . $this->identifier;
533
+		if (! isset($result[$op])) {
534
+					$result = "#" . $this->identifier;
535
+		}
527 536
 		return $result[$op];
528 537
 	}
529 538
 
@@ -546,8 +555,9 @@  discard block
 block discarded – undo
546 555
 	}
547 556
 
548 557
 	public function getRefreshSelector() {
549
-		if (isset($this->_refreshSelector))
550
-			return $this->_refreshSelector;
558
+		if (isset($this->_refreshSelector)) {
559
+					return $this->_refreshSelector;
560
+		}
551 561
 		return "#" . $this->identifier . " tbody";
552 562
 	}
553 563
 
@@ -568,8 +578,9 @@  discard block
 block discarded – undo
568 578
 	 */
569 579
 	public function show($modelInstance) {
570 580
 		if (\is_array($modelInstance)) {
571
-			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
572
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
581
+			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0])) {
582
+							$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
583
+			}
573 584
 		}
574 585
 		$this->_modelInstance = $modelInstance;
575 586
 	}
@@ -611,8 +622,9 @@  discard block
 block discarded – undo
611 622
 	}
612 623
 
613 624
 	public function hideColumn($colIndex) {
614
-		if (! \is_array($this->_hiddenColumns))
615
-			$this->_hiddenColumns = [];
625
+		if (! \is_array($this->_hiddenColumns)) {
626
+					$this->_hiddenColumns = [];
627
+		}
616 628
 		$this->_hiddenColumns[] = $colIndex;
617 629
 		return $this;
618 630
 	}
Please login to merge, or discard this patch.
Ajax/service/JArray.php 1 patch
Braces   +15 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,21 +12,24 @@  discard block
 block discarded – undo
12 12
 			return $array[$key];
13 13
 		}
14 14
 		$values = array_values($array);
15
-		if ($pos < sizeof($values))
16
-			return $values[$pos];
15
+		if ($pos < sizeof($values)) {
16
+					return $values[$pos];
17
+		}
17 18
 	}
18 19
 
19 20
 	public static function getConditionalValue($array, $key, $condition) {
20 21
 		$result = NULL;
21 22
 		if (array_key_exists($key, $array)) {
22 23
 			$result = $array[$key];
23
-			if ($condition($result) === true)
24
-				return $result;
24
+			if ($condition($result) === true) {
25
+							return $result;
26
+			}
25 27
 		}
26 28
 		$values = array_values($array);
27 29
 		foreach ($values as $val) {
28
-			if ($condition($val) === true)
29
-				return $val;
30
+			if ($condition($val) === true) {
31
+							return $val;
32
+			}
30 33
 		}
31 34
 		return $result;
32 35
 	}
@@ -34,8 +37,9 @@  discard block
 block discarded – undo
34 37
 	public static function getDefaultValue($array, $key, $default = NULL) {
35 38
 		if (array_key_exists($key, $array)) {
36 39
 			return $array[$key];
37
-		} else
38
-			return $default;
40
+		} else {
41
+					return $default;
42
+		}
39 43
 	}
40 44
 
41 45
 	public static function implode($glue, $pieces) {
@@ -116,12 +120,12 @@  discard block
 block discarded – undo
116 120
 	}
117 121
 
118 122
 	private static function callFunction($object, $callback) {
119
-		if (\is_string($callback))
120
-			return \call_user_func(array(
123
+		if (\is_string($callback)) {
124
+					return \call_user_func(array(
121 125
 				$object,
122 126
 				$callback
123 127
 			), []);
124
-		else if (\is_callable($callback)) {
128
+		} else if (\is_callable($callback)) {
125 129
 			return $callback($object);
126 130
 		}
127 131
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButton.php 1 patch
Braces   +18 added lines, -13 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	public function setFocusable($value = true) {
74
-		if ($value === true)
75
-			$this->setProperty("tabindex", "0");
76
-		else {
74
+		if ($value === true) {
75
+					$this->setProperty("tabindex", "0");
76
+		} else {
77 77
 			$this->removeProperty("tabindex");
78 78
 		}
79 79
 		return $this;
@@ -126,8 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function addLabel($label, $before = false, $icon = NULL) {
127 127
 		$this->tagName = "div";
128 128
 		$prefix = "";
129
-		if ($before)
130
-			$prefix = "left ";
129
+		if ($before) {
130
+					$prefix = "left ";
131
+		}
131 132
 		$this->addToProperty("class", $prefix . "labeled");
132 133
 		$isIcon = (isset($this->content[0]) && $this->content[0] instanceof HtmlIcon);
133 134
 		$this->content = new HtmlButton("button-" . $this->identifier, $this->content);
@@ -165,11 +166,13 @@  discard block
 block discarded – undo
165 166
 	public function setColor($color) {
166 167
 		if (\is_array($this->content)) {
167 168
 			foreach ($this->content as $content) {
168
-				if ($content instanceof HtmlButton)
169
-					$content->setColor($color);
169
+				if ($content instanceof HtmlButton) {
170
+									$content->setColor($color);
171
+				}
170 172
 			}
171
-		} else
172
-			parent::setColor($color);
173
+		} else {
174
+					parent::setColor($color);
175
+		}
173 176
 		return $this;
174 177
 	}
175 178
 
@@ -226,8 +229,9 @@  discard block
 block discarded – undo
226 229
 	 * @return HtmlButton
227 230
 	 */
228 231
 	public static function social($identifier, $social, $value = NULL) {
229
-		if ($value === NULL)
230
-			$value = \ucfirst($social);
232
+		if ($value === NULL) {
233
+					$value = \ucfirst($social);
234
+		}
231 235
 		$return = new HtmlButton($identifier, $value);
232 236
 		$return->addIcon($social);
233 237
 		return $return->addToPropertyCtrl("class", $social, Social::getConstants());
@@ -286,8 +290,9 @@  discard block
 block discarded – undo
286 290
 			$value
287 291
 		]);
288 292
 		$dd = $result->addDropdown($items, $asCombo);
289
-		if (isset($icon) && $dd instanceof HtmlDropdown)
290
-			$dd->setIcon($icon);
293
+		if (isset($icon) && $dd instanceof HtmlDropdown) {
294
+					$dd->setIcon($icon);
295
+		}
291 296
 		return $result;
292 297
 	}
293 298
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Braces   +23 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	private function afterInsert($item) {
65
-		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
66
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
67
-		else {
65
+		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) {
66
+					$item->addToPropertyCtrl("class", "item", array ("item" ));
67
+		} else {
68 68
 			$this->setSecondary();
69 69
 		}
70 70
 		return $item;
@@ -79,8 +79,9 @@  discard block
 block discarded – undo
79 79
 	public function addItem($item) {
80 80
 		$number=$item;
81 81
 		$item=parent::addItem($this->getItemToInsert($item));
82
-		if(\is_int($number))
83
-			$item->setProperty("data-page", $number);
82
+		if(\is_int($number)) {
83
+					$item->setProperty("data-page", $number);
84
+		}
84 85
 		return $this->afterInsert($item);
85 86
 	}
86 87
 
@@ -121,7 +122,7 @@  discard block
 block discarded – undo
121 122
 		if(!($caption instanceof HtmlDoubleElement)){
122 123
 			$header=new HtmlDoubleElement('','div');
123 124
 			$header->setContent($caption);
124
-		}else{
125
+		} else{
125 126
 			$header=$caption;
126 127
 		}
127 128
 		$header->addClass('item header');
@@ -166,10 +167,11 @@  discard block
 block discarded – undo
166 167
 	}
167 168
 
168 169
 	public function setSecondary($value=true) {
169
-		if($value)
170
-			$this->addToProperty("class", "secondary");
171
-		else
172
-			$this->removePropertyValue("class", "secondary");
170
+		if($value) {
171
+					$this->addToProperty("class", "secondary");
172
+		} else {
173
+					$this->removePropertyValue("class", "secondary");
174
+		}
173 175
 		return $this;
174 176
 	}
175 177
 
@@ -189,8 +191,9 @@  discard block
 block discarded – undo
189 191
 		$this->apply(function (HtmlDoubleElement &$item) {
190 192
 			$item->setTagName("a");
191 193
 		});
192
-		if ($vertical === true)
193
-			$this->setVertical();
194
+		if ($vertical === true) {
195
+					$this->setVertical();
196
+		}
194 197
 		return $this->addToProperty("class", "tabular");
195 198
 	}
196 199
 
@@ -219,10 +222,11 @@  discard block
 block discarded – undo
219 222
 	 */
220 223
 	public function fromDatabaseObject($object, $function) {
221 224
 		$return=$function($object);
222
-		if (\is_array($return))
223
-			$this->addItems($return);
224
-		else
225
-			$this->addItem($return);
225
+		if (\is_array($return)) {
226
+					$this->addItems($return);
227
+		} else {
228
+					$this->addItem($return);
229
+		}
226 230
 	}
227 231
 
228 232
 	/**
@@ -255,8 +259,9 @@  discard block
 block discarded – undo
255 259
 	}
256 260
 
257 261
 	public function run(JsUtils $js){
258
-		if($this->identifier!=="" && !isset($this->_bsComponent))
259
-			$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
262
+		if($this->identifier!=="" && !isset($this->_bsComponent)) {
263
+					$this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false);
264
+		}
260 265
 		$result= parent::run($js);
261 266
 		return $result->setItemSelector(">.item:not(.header)");
262 267
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
 		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
59 59
 		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
60 60
 		$retour = $this->_addJsCondition($jsCondition, $retour);
61
-		if ($immediatly)
62
-			$this->jquery_code_for_compile[] = $retour;
61
+		if ($immediatly) {
62
+					$this->jquery_code_for_compile[] = $retour;
63
+		}
63 64
 		return $retour;
64 65
 	}
65 66
 
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 				$retour .= "url=url+'" . $slash . "'+$(this).html();\n";
115 116
 			} elseif (\substr($attr, 0, 3) === "js:") {
116 117
 				$retour .= "url=url+'" . $slash . "'+" . \substr($attr, 3) . ";\n";
117
-			} elseif ($attr !== null && $attr !== "")
118
-				$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
118
+			} elseif ($attr !== null && $attr !== "") {
119
+							$retour .= "url=url+'" . $slash . "'+($(this).attr('" . $attr . "')||'');\n";
120
+			}
119 121
 		}
120 122
 		return $retour;
121 123
 	}
@@ -139,10 +141,11 @@  discard block
 block discarded – undo
139 141
 			} elseif (isset($this->ajaxTransition)) {
140 142
 				$call = $this->ajaxTransition;
141 143
 			}
142
-			if (\is_callable($call))
143
-				$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
144
-			else
145
-				$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
144
+			if (\is_callable($call)) {
145
+							$retour = "\t" . $call($responseElement, $jqueryDone) . ";\n";
146
+			} else {
147
+							$retour = "\t{$responseElement}.{$jqueryDone}( data );\n";
148
+			}
146 149
 		}
147 150
 		if (isset($history)) {
148 151
 			if ($this->params["autoActiveLinks"]) {
@@ -165,8 +168,9 @@  discard block
 block discarded – undo
165 168
 	}
166 169
 
167 170
 	protected function _correctAjaxUrl($url) {
168
-		if ($url !== "/" && JString::endsWith($url, "/") === true)
169
-			$url = substr($url, 0, strlen($url) - 1);
171
+		if ($url !== "/" && JString::endsWith($url, "/") === true) {
172
+					$url = substr($url, 0, strlen($url) - 1);
173
+		}
170 174
 		if (strncmp($url, 'http://', 7) != 0 && strncmp($url, 'https://', 8) != 0) {
171 175
 			$url = $this->getUrl($url);
172 176
 		}
@@ -190,8 +194,9 @@  discard block
 block discarded – undo
190 194
 	public static function _implodeParams($parameters) {
191 195
 		$allParameters = [];
192 196
 		foreach ($parameters as $params) {
193
-			if (isset($params))
194
-				$allParameters[] = self::_correctParams($params);
197
+			if (isset($params)) {
198
+							$allParameters[] = self::_correctParams($params);
199
+			}
195 200
 		}
196 201
 		return \implode("+'&'+", $allParameters);
197 202
 	}
@@ -217,8 +222,9 @@  discard block
 block discarded – undo
217 222
 
218 223
 	protected function setDefaultParameters(&$parameters, $default) {
219 224
 		foreach ($default as $k => $v) {
220
-			if (! isset($parameters[$k]))
221
-				$parameters[$k] = $v;
225
+			if (! isset($parameters[$k])) {
226
+							$parameters[$k] = $v;
227
+			}
222 228
 		}
223 229
 	}
224 230
 
@@ -712,7 +718,7 @@  discard block
 block discarded – undo
712 718
 			if (isset($params)) {
713 719
 				$retour .= "params+='&'+" . self::_correctParams($params) . ";\n";
714 720
 			}
715
-		}else{
721
+		} else{
716 722
 			$retour .= "\nvar params=new FormData($('#" . $form . "')[0]);\n";
717 723
 		}
718 724
 		$responseElement = $this->_getResponseElement($responseElement);
@@ -742,8 +748,9 @@  discard block
 block discarded – undo
742 748
 			$retour .= "$('#" . $form . "').submit();\n";
743 749
 		}
744 750
 		$retour = $this->_addJsCondition($jsCondition, $retour);
745
-		if ($immediatly)
746
-			$this->jquery_code_for_compile[] = $retour;
751
+		if ($immediatly) {
752
+					$this->jquery_code_for_compile[] = $retour;
753
+		}
747 754
 		return $retour;
748 755
 	}
749 756
 
Please login to merge, or discard this patch.