Passed
Push — master ( 2c24bb...e33ab3 )
by Jean-Christophe
02:11
created
Ajax/common/html/BaseHtml.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -109,15 +109,18 @@  discard block
 block discarded – undo
109 109
 			$flag=false;
110 110
 			$index=0;
111 111
 			while ( !$flag && $index < sizeof($elements) ) {
112
-				if ($elements[$index] instanceof BaseHtml)
113
-					$flag=($callback($elements[$index]));
112
+				if ($elements[$index] instanceof BaseHtml) {
113
+									$flag=($callback($elements[$index]));
114
+				}
114 115
 					$index++;
115 116
 			}
116
-			if ($flag === true)
117
-				return $elements[$index - 1];
117
+			if ($flag === true) {
118
+							return $elements[$index - 1];
119
+			}
118 120
 		} elseif ($elements instanceof BaseHtml) {
119
-			if ($callback($elements))
120
-				return $elements;
121
+			if ($callback($elements)) {
122
+							return $elements;
123
+			}
121 124
 		}
122 125
 		return null;
123 126
 	}
@@ -143,8 +146,9 @@  discard block
 block discarded – undo
143 146
 
144 147
 	public function fromArray($array) {
145 148
 		foreach ( $this as $key => $value ) {
146
-			if(array_key_exists($key, $array)===true)
147
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
149
+			if(array_key_exists($key, $array)===true) {
150
+							$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
151
+			}
148 152
 		}
149 153
 		foreach ( $array as $key => $value ) {
150 154
 			if($this->_callSetter($key, $key, $value, $array)===false){
@@ -213,9 +217,9 @@  discard block
 block discarded – undo
213 217
 				if(\strstr($result, "%{$key}%")!==false){
214 218
 					if (\is_array($value)) {
215 219
 						$v=PropertyWrapper::wrap($value, $js);
216
-					}elseif($value instanceof \stdClass){
220
+					} elseif($value instanceof \stdClass){
217 221
 							$v=\print_r($value,true);
218
-					}else{
222
+					} else{
219 223
 						$v=$value;
220 224
 					}
221 225
 					$result=str_replace("%{$key}%", $v, $result);
Please login to merge, or discard this patch.
Ajax/common/html/PropertyWrapper.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@
 block discarded – undo
25 25
 
26 26
 	private static function containsElement($input) {
27 27
 		foreach ( $input as $v ) {
28
-			if (\is_object($v) || \is_array($v))
29
-				return true;
28
+			if (\is_object($v) || \is_array($v)) {
29
+							return true;
30
+			}
30 31
 		}
31 32
 		return false;
32 33
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsInternalTrait.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,8 +16,9 @@  discard block
 block discarded – undo
16 16
 	 * @param mixed $view
17 17
 	 */
18 18
 	protected function _compileLibrary(BaseGui $library=NULL, &$view=NULL){
19
-		if(isset($view))
20
-			$library->compileHtml($this, $view);
19
+		if(isset($view)) {
20
+					$library->compileHtml($this, $view);
21
+		}
21 22
 		if ($library->isAutoCompile()) {
22 23
 			$library->compile(true);
23 24
 		}
@@ -36,7 +37,9 @@  discard block
 block discarded – undo
36 37
 	}
37 38
 
38 39
 	protected function minify($input) {
39
-		if(trim($input) === "") return $input;
40
+		if(trim($input) === "") {
41
+			return $input;
42
+		}
40 43
 		return preg_replace(
41 44
 				array(
42 45
 						// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -120,25 +120,29 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 
122 122
 	public function getColPosition($colIndex) {
123
-		if($this->_container->_isMerged()!==true)
124
-			return $colIndex;
123
+		if($this->_container->_isMerged()!==true) {
124
+					return $colIndex;
125
+		}
125 126
 		$pos=0;
126 127
 		$rows=$this->_container->getContent();
127 128
 		for($i=0; $i < $this->_row; $i++) {
128 129
 			$max=\min($colIndex, $rows[$i]->count());
129 130
 			for($j=0; $j < $max; $j++) {
130 131
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
131
-				if ($rowspan + $i > $this->_row)
132
-					$pos++;
132
+				if ($rowspan + $i > $this->_row) {
133
+									$pos++;
134
+				}
133 135
 			}
134 136
 		}
135
-		if ($pos > $colIndex)
136
-			return NULL;
137
+		if ($pos > $colIndex) {
138
+					return NULL;
139
+		}
137 140
 		$count=$this->count();
138 141
 		for($i=0; $i < $count; $i++) {
139 142
 			$pos+=$this->content[$i]->getColspan();
140
-			if ($pos >= $colIndex + 1)
141
-				return $i;
143
+			if ($pos >= $colIndex + 1) {
144
+							return $i;
145
+			}
142 146
 		}
143 147
 		return null;
144 148
 	}
@@ -161,8 +165,9 @@  discard block
 block discarded – undo
161 165
 	public function containsStr($needle) {
162 166
 		$cells=$this->content;
163 167
 		foreach ( $cells as $cell ) {
164
-			if (\strpos($cell->getContent(), $needle) !== false)
165
-				return true;
168
+			if (\strpos($cell->getContent(), $needle) !== false) {
169
+							return true;
170
+			}
166 171
 		}
167 172
 		return false;
168 173
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlModal.php 1 patch
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 			foreach ($actions as $action){
44 44
 				$this->addAction($action);
45 45
 			}
46
-		}
47
-		else{
46
+		} else{
48 47
 			$this->addAction($actions);
49 48
 		}
50 49
 		return $this;
@@ -64,8 +63,9 @@  discard block
 block discarded – undo
64 63
 				$class="cancel";
65 64
 			}
66 65
 			$action=new HtmlButton("action-".$this->identifier."-".JArray::count($this->content["actions"]->getContent()),$action);
67
-			if($class!=="")
68
-				$action->addToProperty("class", $class);
66
+			if($class!=="") {
67
+							$action->addToProperty("class", $class);
68
+			}
69 69
 		}
70 70
 		return $this->addElementInPart($action, "actions");
71 71
 	}
@@ -174,8 +174,9 @@  discard block
 block discarded – undo
174 174
 	 * @see BaseHtml::run()
175 175
 	 */
176 176
 	public function run(JsUtils $js) {
177
-		if(isset($this->_bsComponent)===false)
178
-			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts);
177
+		if(isset($this->_bsComponent)===false) {
178
+					$this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts);
179
+		}
179 180
 		$this->addEventsOnRun($js);
180 181
 		return $this->_bsComponent;
181 182
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Braces   +24 added lines, -19 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		if(isset($value)){
37 37
 			if($value instanceof HtmlSemDoubleElement){
38 38
 				$text=$value;
39
-			}else{
39
+			} else{
40 40
 				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
41 41
 				$text->setClass("text");
42 42
 				$this->setValue($value);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		}
110 110
 		if(!$item instanceof HtmlDropdownItem){
111 111
 			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
112
-		}elseif($itemO instanceof HtmlDropdownItem){
112
+		} elseif($itemO instanceof HtmlDropdownItem){
113 113
 			$this->addToProperty("class", "vertical");
114 114
 		}
115 115
 		return $itemO;
@@ -123,8 +123,9 @@  discard block
 block discarded – undo
123 123
 	}
124 124
 
125 125
 	public function addInput($name){
126
-		if(!isset($name))
127
-			$name="input-".$this->identifier;
126
+		if(!isset($name)) {
127
+					$name="input-".$this->identifier;
128
+		}
128 129
 		$this->setAction("activate");
129 130
 		$this->input=new HtmlInput($name,"hidden");
130 131
 		$this->input->setIdentifier("input-".$this->identifier);
@@ -183,7 +184,7 @@  discard block
 block discarded – undo
183 184
 			foreach ($items as $k=>$v){
184 185
 				$this->addItem($v)->setData($k);
185 186
 			}
186
-		}else{
187
+		} else{
187 188
 			foreach ($items as $item){
188 189
 				$this->addItem($item);
189 190
 			}
@@ -205,8 +206,7 @@  discard block
 block discarded – undo
205 206
 			$c=$this->items[$i++];
206 207
 			if(isset($c)){
207 208
 				$c->setProperty($property,$value);
208
-			}
209
-			else{
209
+			} else{
210 210
 				return $this;
211 211
 			}
212 212
 		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		if($dropdown===false){
238 238
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
239 239
 			$dropdown="menu";
240
-		}else{
240
+		} else{
241 241
 			$dropdown="dropdown";
242 242
 			$this->mClass="menu";
243 243
 		}
@@ -258,22 +258,25 @@  discard block
 block discarded – undo
258 258
 
259 259
 	public function asButton($floating=false){
260 260
 		$this->removeArrow();
261
-		if($floating)
262
-			$this->addToProperty("class", "floating");
261
+		if($floating) {
262
+					$this->addToProperty("class", "floating");
263
+		}
263 264
 		$this->removePropertyValue("class", "selection");
264 265
 		return $this->addToProperty("class", "button");
265 266
 	}
266 267
 
267 268
 	public function asSelect($name=NULL,$multiple=false,$selection=true){
268 269
 		$this->_multiple=$multiple;
269
-		if(isset($name))
270
-			$this->addInput($name);
270
+		if(isset($name)) {
271
+					$this->addInput($name);
272
+		}
271 273
 		if($multiple){
272 274
 			$this->addToProperty("class", "multiple");
273 275
 		}
274 276
 		if ($selection){
275
-			if($this->propertyContains("class", "button")===false)
276
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
277
+			if($this->propertyContains("class", "button")===false) {
278
+							$this->addToPropertyCtrl("class", "selection",array("selection"));
279
+			}
277 280
 		}
278 281
 		return $this;
279 282
 	}
@@ -284,8 +287,9 @@  discard block
 block discarded – undo
284 287
 	}
285 288
 
286 289
 	public function setSelect($name=NULL,$multiple=false){
287
-		if(!isset($name))
288
-			$name="select-".$this->identifier;
290
+		if(!isset($name)) {
291
+					$name="select-".$this->identifier;
292
+		}
289 293
 		$this->input=null;
290 294
 		if($multiple){
291 295
 			$this->setProperty("multiple", true);
@@ -321,12 +325,13 @@  discard block
 block discarded – undo
321 325
 		$value=$this->value;
322 326
 		if(isset($this->input) && isset($value)){
323 327
 			$this->input->setProperty("value", $value);
324
-		}else{
328
+		} else{
325 329
 			$this->setProperty("value", $value);
326 330
 		}
327 331
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
328
-			if(isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
329
-				$textElement->setContent($value);
332
+			if(isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple) {
333
+							$textElement->setContent($value);
334
+			}
330 335
 		return $this;
331 336
 	}
332 337
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTD.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,15 +84,17 @@  discard block
 block discarded – undo
84 84
 
85 85
 	public function getColspan() {
86 86
 		$colspan=1;
87
-		if (\array_key_exists("colspan", $this->properties))
88
-			$colspan=$this->getProperty("colspan");
87
+		if (\array_key_exists("colspan", $this->properties)) {
88
+					$colspan=$this->getProperty("colspan");
89
+		}
89 90
 		return $colspan;
90 91
 	}
91 92
 
92 93
 	public function getRowspan() {
93 94
 		$rowspan=1;
94
-		if (\array_key_exists("rowspan", $this->properties))
95
-			$rowspan=$this->getProperty("rowspan");
95
+		if (\array_key_exists("rowspan", $this->properties)) {
96
+					$rowspan=$this->getProperty("rowspan");
97
+		}
96 98
 		return $rowspan;
97 99
 	}
98 100
 
@@ -129,7 +131,8 @@  discard block
 block discarded – undo
129 131
 	}
130 132
 
131 133
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
132
-		if(!$this->_deleted)
133
-			return parent::compile();
134
+		if(!$this->_deleted) {
135
+					return parent::compile();
136
+		}
134 137
 	}
135 138
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 1 patch
Braces   +42 added lines, -36 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
 	}
@@ -100,16 +103,16 @@  discard block
 block discarded – undo
100 103
 		if($property instanceof \ReflectionProperty){
101 104
 			$value=$this->_getPropertyValue($property, $index);
102 105
 			$propertyName=$property->getName();
103
-		}elseif(\is_callable($property))
104
-			$value=$property($this->instance);
105
-		elseif(\is_array($property)){
106
+		} elseif(\is_callable($property)) {
107
+					$value=$property($this->instance);
108
+		} elseif(\is_array($property)){
106 109
 			$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
107 110
 			$value=\implode("", $values);
108
-		}elseif(\is_string($property)){
111
+		} elseif(\is_string($property)){
109 112
 			$value=$property;
110 113
 			if(isset($this->instance->{$property})){
111 114
 				$value=$this->instance->{$property};
112
-			}elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
115
+			} elseif(\method_exists($this->instance, $getter=JReflection::getterName($property))){
113 116
 				$value=JReflection::callMethod($this->instance, $getter, []);
114 117
 			}
115 118
 		}
@@ -119,7 +122,7 @@  discard block
 block discarded – undo
119 122
 	protected function _postGetValue($index,$propertyName,$value){
120 123
 		if(isset($this->values[$index])){
121 124
 			$value= $this->values[$index]($value,$this->instance,$index,self::$index);
122
-		}else{
125
+		} else{
123 126
 			$value=$this->_getDefaultValue($propertyName,$value, $index,self::$index);
124 127
 		}
125 128
 		if(isset($this->afterCompile[$index])){
@@ -140,10 +143,10 @@  discard block
 block discarded – undo
140 143
 		if(isset($vb[$index])){
141 144
 			if(\is_array($vb[$index])){
142 145
 				$this->visibleProperties[$index][]=$field;
143
-			}else{
146
+			} else{
144 147
 				$this->visibleProperties[$index]=[$vb[$index],$field];
145 148
 			}
146
-		}else{
149
+		} else{
147 150
 			return $this->insertField($index, $field);
148 151
 		}
149 152
 		return $this;
@@ -175,9 +178,9 @@  discard block
 block discarded – undo
175 178
 		$property=$this->getProperty($index);
176 179
 		if($property instanceof \ReflectionProperty){
177 180
 			$result=$property->getName();
178
-		}elseif(\is_callable($property)){
181
+		} elseif(\is_callable($property)){
179 182
 			$result=$this->visibleProperties[$index];
180
-		}else{
183
+		} else{
181 184
 			$result=$property;
182 185
 		}
183 186
 		return $result;
@@ -197,7 +200,7 @@  discard block
 block discarded – undo
197 200
 		$this->reflect=new \ReflectionClass($instance);
198 201
 		if(JArray::count($this->visibleProperties)===0){
199 202
 			$this->properties=$this->getDefaultProperties();
200
-		}else{
203
+		} else{
201 204
 			foreach ($this->visibleProperties as $property){
202 205
 				$this->setInstanceProperty($property);
203 206
 			}
@@ -208,22 +211,23 @@  discard block
 block discarded – undo
208 211
 	private function setInstanceProperty($property){
209 212
 		if(\is_callable($property)){
210 213
 			$this->properties[]=$property;
211
-		}elseif(\is_string($property)){
214
+		} elseif(\is_string($property)){
212 215
 			try{
213 216
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
214 217
 				$rProperty=$this->reflect->getProperty($property);
215 218
 				$this->properties[]=$rProperty;
216
-			}catch(\Exception $e){
219
+			} catch(\Exception $e){
217 220
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
218 221
 				$this->properties[]=$property;
219 222
 			}
220
-		}elseif(\is_int($property)){
223
+		} elseif(\is_int($property)){
221 224
 			$props=$this->getDefaultProperties();
222
-			if(isset($props[$property]))
223
-				$this->properties[]=$props[$property];
224
-				else
225
-					$this->properties[]=$property;
226
-		}else{
225
+			if(isset($props[$property])) {
226
+							$this->properties[]=$props[$property];
227
+			} else {
228
+									$this->properties[]=$property;
229
+				}
230
+		} else{
227 231
 			$this->properties[]=$property;
228 232
 		}
229 233
 	}
@@ -267,12 +271,13 @@  discard block
 block discarded – undo
267 271
 		if(isset($this->captions[$index])){
268 272
 			return $this->captions[$index];
269 273
 		}
270
-		if($this->properties[$index] instanceof \ReflectionProperty)
271
-			return $this->properties[$index]->getName();
272
-		elseif(\is_callable($this->properties[$index]))
273
-			return "";
274
-		else
275
-			return $this->properties[$index];
274
+		if($this->properties[$index] instanceof \ReflectionProperty) {
275
+					return $this->properties[$index]->getName();
276
+		} elseif(\is_callable($this->properties[$index])) {
277
+					return "";
278
+		} else {
279
+					return $this->properties[$index];
280
+		}
276 281
 	}
277 282
 
278 283
 	public function getCaptions(){
@@ -283,7 +288,7 @@  discard block
 block discarded – undo
283 288
 			for($i=$captionsSize;$i<$count;$i++){
284 289
 				$captions[]="";
285 290
 			}
286
-		}else{
291
+		} else{
287 292
 			$captions=[];
288 293
 			$index=0;
289 294
 			while($index<$count){
@@ -298,8 +303,9 @@  discard block
 block discarded – undo
298 303
 	}
299 304
 
300 305
 	public function setCaption($index,$caption){
301
-		if(isset($this->captions)===false)
302
-			$this->captions=[];
306
+		if(isset($this->captions)===false) {
307
+					$this->captions=[];
308
+		}
303 309
 		$this->captions[$index]=$caption;
304 310
 		return $this;
305 311
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlButtonGroups.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
 	protected $_dropdown;
19 19
 	public function __construct($identifier, $elements=array(), $asIcons=false) {
20 20
 		parent::__construct($identifier, "div", "ui buttons");
21
-		if ($asIcons === true)
22
-			$this->asIcons();
21
+		if ($asIcons === true) {
22
+					$this->asIcons();
23
+		}
23 24
 		$this->addElements($elements, $asIcons);
24 25
 	}
25 26
 	protected function createItem($value){
@@ -50,8 +51,9 @@  discard block
 block discarded – undo
50 51
 	 */
51 52
 	public function addElement($element, $asIcon=false) {
52 53
 		$item=$this->addItem($element);
53
-		if($asIcon)
54
-			$item->asIcon($element);
54
+		if($asIcon) {
55
+					$item->asIcon($element);
56
+		}
55 57
 		return $item;
56 58
 	}
57 59
 
@@ -79,8 +81,9 @@  discard block
 block discarded – undo
79 81
 
80 82
 	public function asIcons() {
81 83
 		foreach ( $this->content as $item ) {
82
-			if($item instanceof HtmlButton)
83
-			$item->asIcon($item->getContent());
84
+			if($item instanceof HtmlButton) {
85
+						$item->asIcon($item->getContent());
86
+			}
84 87
 		}
85 88
 		return $this->addToProperty("class", "icons");
86 89
 	}
@@ -92,8 +95,9 @@  discard block
 block discarded – undo
92 95
 	 */
93 96
 	public function addIcons($icons){
94 97
 		foreach ( $this->content as $index=>$item ) {
95
-			if($item instanceof HtmlButton && isset($icons[$index]))
96
-				$item->addIcon($icons[$index]);
98
+			if($item instanceof HtmlButton && isset($icons[$index])) {
99
+							$item->addIcon($icons[$index]);
100
+			}
97 101
 		}
98 102
 		return $this;
99 103
 	}
Please login to merge, or discard this patch.