Passed
Push — master ( 852993...2672cd )
by Jean-Christophe
02:59
created
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Braces   +23 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,8 +59,9 @@  discard block
 block discarded – undo
59 59
 		$retour .= "$.ajax({" . $this->implodeAjaxParameters($ajaxParameters) . "}).done(function( data, textStatus, jqXHR ) {\n";
60 60
 		$retour .= $this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback, $hasLoader, ($historize ? $originalSelector : null)) . "});\n";
61 61
 		$retour = $this->_addJsCondition($jsCondition, $retour);
62
-		if ($immediatly)
63
-			$this->jquery_code_for_compile[] = $retour;
62
+		if ($immediatly) {
63
+					$this->jquery_code_for_compile[] = $retour;
64
+		}
64 65
 		return $retour;
65 66
 	}
66 67
 
@@ -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
 
@@ -746,8 +752,9 @@  discard block
 block discarded – undo
746 752
 			$retour .= "$('#" . $form . "').submit();\n";
747 753
 		}
748 754
 		$retour = $this->_addJsCondition($jsCondition, $retour);
749
-		if ($immediatly)
750
-			$this->jquery_code_for_compile[] = $retour;
755
+		if ($immediatly) {
756
+					$this->jquery_code_for_compile[] = $retour;
757
+		}
751 758
 		return $retour;
752 759
 	}
753 760
 
Please login to merge, or discard this patch.