Passed
Push — master ( 31fed0...fdcf95 )
by Jean-Christophe
02:44
created
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.
Ajax/common/components/BaseComponent.php 1 patch
Braces   +12 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
 	public function getParam($key) {
41 41
 		$value=null;
42
-		if (array_key_exists($key, $this->params))
43
-			$value=$this->params [$key];
42
+		if (array_key_exists($key, $this->params)) {
43
+					$value=$this->params [$key];
44
+		}
44 45
 		return $value;
45 46
 	}
46 47
 
@@ -49,16 +50,18 @@  discard block
 block discarded – undo
49 50
 	}
50 51
 
51 52
 	public function compile(JsUtils $js=NULL) {
52
-		if ($js==NULL)
53
-			$js=$this->js;
53
+		if ($js==NULL) {
54
+					$js=$this->js;
55
+		}
54 56
 		$script=$this->getScript();
55 57
 		$js->addToCompile($script);
56 58
 	}
57 59
 
58 60
 	protected function setParamCtrl($key, $value, $typeCtrl) {
59 61
 		if (\is_array($typeCtrl)) {
60
-			if (array_search($value, $typeCtrl)===false)
61
-				throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
62
+			if (array_search($value, $typeCtrl)===false) {
63
+							throw new \Exception("La valeur passée a propriété `".$key."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
64
+			}
62 65
 		} else {
63 66
 			if (!$typeCtrl($value)) {
64 67
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key);
@@ -70,9 +73,9 @@  discard block
 block discarded – undo
70 73
 	public function setParams($params) {
71 74
 		foreach ( $params as $k => $v ) {
72 75
 			$method="set".ucfirst($k);
73
-			if (method_exists($this, $method))
74
-				$this->$method($v);
75
-			else {
76
+			if (method_exists($this, $method)) {
77
+							$this->$method($v);
78
+			} else {
76 79
 				$this->setParam($k, $v);
77 80
 				trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE);
78 81
 			}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormFields.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,12 +29,14 @@  discard block
 block discarded – undo
29 29
 				if (\is_string($end)) {
30 30
 					$label=$end;
31 31
 					\array_pop($fields);
32
-				} else
33
-					$label=NULL;
32
+				} else {
33
+									$label=NULL;
34
+				}
34 35
 			}
35 36
 		}
36
-		if (isset($label))
37
-			$this->setLabel($label);
37
+		if (isset($label)) {
38
+					$this->setLabel($label);
39
+		}
38 40
 		foreach ( $fields as $field ) {
39 41
 			$this->addItem($field);
40 42
 		}
@@ -57,8 +59,9 @@  discard block
 block discarded – undo
57 59
 
58 60
 	public function addItem($item) {
59 61
 		$item=parent::addItem($item);
60
-		if($item instanceof HtmlFormField)
61
-			$item->setContainer($this);
62
+		if($item instanceof HtmlFormField) {
63
+					$item->setContainer($this);
64
+		}
62 65
 		return $item;
63 66
 	}
64 67
 	
@@ -73,8 +76,9 @@  discard block
 block discarded – undo
73 76
 		if ($this->_equalWidth) {
74 77
 			$count=$this->count();
75 78
 			$this->addToProperty("class", Wide::getConstants()["W".$count]." fields");
76
-		} else
77
-			$this->addToProperty("class", "fields");
79
+		} else {
80
+					$this->addToProperty("class", "fields");
81
+		}
78 82
 		return parent::compile($js, $view);
79 83
 	}
80 84
 
@@ -136,8 +140,9 @@  discard block
 block discarded – undo
136 140
 			$fields[]=$itemO;
137 141
 		}
138 142
 		$radios=new HtmlFormFields($identifier, $fields);
139
-		if (isset($label))
140
-			$radios->setLabel($label)->setProperty("for", $name);
143
+		if (isset($label)) {
144
+					$radios->setLabel($label)->setProperty("for", $name);
145
+		}
141 146
 		return $radios;
142 147
 	}
143 148
 
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlEmoji.php 1 patch
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,20 +57,23 @@
 block discarded – undo
57 57
 	public function asLink($href=NULL,$target=NULL) {
58 58
 		if (isset($href)) {
59 59
 			$_target="";
60
-			if(isset($target))
61
-				$_target="target='{$target}'";
60
+			if(isset($target)) {
61
+							$_target="target='{$target}'";
62
+			}
62 63
 			$this->wrap("<a href='" . $href . "' {$_target}>", "</a>");
63 64
 		}
64 65
 		return $this->addToProperty("class", "link");
65 66
 	}
66 67
 
67 68
 	public function addLabel($label, $before=false, $emoji=null) {
68
-		if($before)
69
-			$this->wrap($label);
70
-		else
71
-			$this->wrap("", $label);
72
-		if($emoji!=null)
73
-			$this->setEmoji($emoji);
69
+		if($before) {
70
+					$this->wrap($label);
71
+		} else {
72
+					$this->wrap("", $label);
73
+		}
74
+		if($emoji!=null) {
75
+					$this->setEmoji($emoji);
76
+		}
74 77
 		return $this;
75 78
 	}
76 79
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlListItem.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@
 block discarded – undo
47 47
 
48 48
 	public function addList($items = array(), $ordered = false) {
49 49
 		$list = new HtmlList("", $items);
50
-		if ($ordered)
51
-			$list->setOrdered();
50
+		if ($ordered) {
51
+					$list->setOrdered();
52
+		}
52 53
 		$list->setClass("list");
53 54
 		$this->content["list"] = $list;
54 55
 		return $list;
Please login to merge, or discard this patch.