Passed
Push — master ( ccea9a...7a8d95 )
by Jean-Christophe
01:50
created
Ajax/service/AjaxCall.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
 		$this->parameters["immediatly"]=false;
24 24
 		extract($this->parameters);
25 25
 		$result=$this->_eventPreparing($preventDefault, $stopPropagation);
26
-		switch($this->method) {
26
+		switch ($this->method) {
27 27
 			case "get":
28 28
 				$result.=$js->getDeferred($url, $responseElement, $this->parameters);
29 29
 				break;
30 30
 			case "post":
31
-				$result.=$js->postDeferred($url, $params,$responseElement, $this->parameters);
31
+				$result.=$js->postDeferred($url, $params, $responseElement, $this->parameters);
32 32
 				break;
33 33
 			case "postForm":
34 34
 				$result.=$js->postFormDeferred($url, $form, $responseElement, $this->parameters);
35 35
 				break;
36 36
 			case "json":
37
-				$result.=$js->jsonDeferred($url,$method,$this->parameters);
37
+				$result.=$js->jsonDeferred($url, $method, $this->parameters);
38 38
 				break;
39 39
 			case "jsonArray":
40
-				$result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$this->parameters);
40
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $this->parameters);
41 41
 				break;
42 42
 			default:
43 43
 				break;
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		return $result;
46 46
 	}
47 47
 
48
-	protected function _eventPreparing($preventDefault,$stopPropagation){
48
+	protected function _eventPreparing($preventDefault, $stopPropagation) {
49 49
 		$result="";
50 50
 		if ($preventDefault===true) {
51 51
 			$result.=Javascript::$preventDefault;
Please login to merge, or discard this patch.
Ajax/common/html/html5/HtmlUtils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@
 block discarded – undo
3 3
 namespace Ajax\common\html\html5;
4 4
 
5 5
 class HtmlUtils {
6
-	public static function javascriptInclude($url){
6
+	public static function javascriptInclude($url) {
7 7
 		return '<script src="'.$url.'"></script>';
8 8
 	}
9 9
 	
10
-	public static function stylesheetInclude($url){
10
+	public static function stylesheetInclude($url) {
11 11
 		return '<link rel="stylesheet" type="text/css" href="'.$url.'">';
12 12
 	}
13 13
 }
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlPropertiesTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  * @author jc
9 9
  * @property BaseWidget $_self
10 10
  */
11
-trait BaseHtmlPropertiesTrait{
11
+trait BaseHtmlPropertiesTrait {
12 12
 
13
-	protected $properties=array ();
13
+	protected $properties=array();
14 14
 	abstract protected function ctrl($name, $value, $typeCtrl);
15 15
 	abstract protected function removeOldValues(&$oldValue, $allValues);
16
-	abstract protected function _getElementBy($callback,$elements);
16
+	abstract protected function _getElementBy($callback, $elements);
17 17
 	public function getProperties() {
18 18
 		return $this->_self->properties;
19 19
 	}
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public function addToProperty($name, $value, $separator=" ") {
47 47
 		if (\is_array($value)) {
48
-			foreach ( $value as $v ) {
48
+			foreach ($value as $v) {
49 49
 				$this->_self->addToProperty($name, $v, $separator);
50 50
 			}
51
-		} else if ($value !== "" && $this->_self->propertyContains($name, $value) === false) {
52
-			if(isset($this->_self->properties[$name])){
51
+		} else if ($value!=="" && $this->_self->propertyContains($name, $value)===false) {
52
+			if (isset($this->_self->properties[$name])) {
53 53
 				$v=$this->_self->properties[$name];
54
-				if (isset($v) && $v !== "")
55
-					$v=$v . $separator . $value;
54
+				if (isset($v) && $v!=="")
55
+					$v=$v.$separator.$value;
56 56
 					else
57 57
 						$v=$value;
58 58
 	
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	}
92 92
 
93 93
 	public function addToPropertyCtrlCheck($name, $value, $typeCtrl) {
94
-		if ($this->_self->ctrl($name, $value, $typeCtrl) === true) {
94
+		if ($this->_self->ctrl($name, $value, $typeCtrl)===true) {
95 95
 			return $this->_self->addToProperty($name, $value);
96 96
 		}
97 97
 		return $this;
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 	}
113 113
 
114 114
 	protected function setPropertyCtrl($name, $value, $typeCtrl) {
115
-		if ($this->_self->ctrl($name, $value, $typeCtrl) === true)
115
+		if ($this->_self->ctrl($name, $value, $typeCtrl)===true)
116 116
 			return $this->_self->setProperty($name, $value);
117 117
 			return $this;
118 118
 	}
119 119
 
120
-	protected function getElementByPropertyValue($propertyName,$value, $elements) {
121
-		return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements);
120
+	protected function getElementByPropertyValue($propertyName, $value, $elements) {
121
+		return $this->_self->_getElementBy(function(BaseHtml $element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements);
122 122
 	}
123 123
 }
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlNavbar.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	public function __construct($identifier, $brand="Brand", $brandHref="#") {
33 33
 		parent::__construct($identifier);
34 34
 		$this->_template=include 'templates/tplNavbar.php';
35
-		$this->navZones=array ();
35
+		$this->navZones=array();
36 36
 		$this->class="navbar-default";
37 37
 		$this->brand=$brand;
38 38
 		$this->brandHref=$brandHref;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	public function setBrandImage($imageSrc) {
63
-		$this->brandImage=new HtmlImg("brand-img-".$this->_identifier,$imageSrc,$this->brand);
63
+		$this->brandImage=new HtmlImg("brand-img-".$this->_identifier, $imageSrc, $this->brand);
64 64
 		$this->brand="";
65 65
 		return $this;
66 66
 	}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 	public function setNavZones($navZones) {
106 106
 		if (\is_array($navZones)) {
107
-			foreach ( $navZones as $zoneType => $zoneArray ) {
107
+			foreach ($navZones as $zoneType => $zoneArray) {
108 108
 				if (is_string($zoneType)) {
109 109
 					$zone=$this->addZone($zoneType);
110 110
 					$zone->fromArray($zoneArray);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			if ($index<$nb)
145 145
 				$zone=$this->navZones [$index];
146 146
 		} else {
147
-			for($i=0; $i<$nb; $i++) {
147
+			for ($i=0; $i<$nb; $i++) {
148 148
 				if ($this->navZones [$i]->getIdentifier()===$index) {
149 149
 					$zone=$this->navZones [$i];
150 150
 					break;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	public function run(JsUtils $js) {
158
-		foreach ( $this->navZones as $zone ) {
158
+		foreach ($this->navZones as $zone) {
159 159
 			$zone->run($js);
160 160
 		}
161 161
 		if ($this->hasScrollspy) {
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	}
178 178
 
179 179
 	public function setFluid($fluid) {
180
-		if($fluid===true){
180
+		if ($fluid===true) {
181 181
 			$this->fluid="container-fluid";
182
-		}else{
182
+		} else {
183 183
 			$this->fluid="container";
184 184
 		}
185 185
 		return $this;
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsActionsTrait.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 trait JsUtilsActionsTrait {
13 13
 
14
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
14
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
15 15
 	/**
16 16
 	 * show or hide with effect
17 17
 	 *
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @param boolean $immediatly defers the execution if set to false
23 23
 	 * @return string
24 24
 	 */
25
-	protected function _showHideWithEffect($action,$element='this', $speed='', $callback='', $immediatly=false) {
25
+	protected function _showHideWithEffect($action, $element='this', $speed='', $callback='', $immediatly=false) {
26 26
 		$element=Javascript::prep_element($element);
27 27
 		$speed=$this->_validate_speed($speed);
28 28
 		if ($callback!='') {
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 * @return string
40 40
 	 */
41 41
 	private function _validate_speed($speed) {
42
-		if (in_array($speed, array (
43
-				'slow','normal','fast'
42
+		if (in_array($speed, array(
43
+				'slow', 'normal', 'fast'
44 44
 		))) {
45 45
 			$speed='"'.$speed.'"';
46 46
 		} elseif (preg_match("/[^0-9]/", $speed)) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @param string $param
58 58
 	 * @param boolean $immediatly delayed if false
59 59
 	 */
60
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
60
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
61 61
 		$element=Javascript::prep_element($element);
62 62
 		if (isset($param)) {
63 63
 			$param=Javascript::prep_value($param);
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param boolean $immediatly delayed if false
78 78
 	 * @return string
79 79
 	 */
80
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
80
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
81 81
 		$to=Javascript::prep_element($to);
82 82
 		$element=Javascript::prep_element($element);
83 83
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return string
95 95
 	 */
96 96
 	public function addClass($element='this', $class='', $immediatly=false) {
97
-		return $this->_genericCallValue('addClass',$element, $class, $immediatly);
97
+		return $this->_genericCallValue('addClass', $element, $class, $immediatly);
98 98
 	}
99 99
 
100 100
 	/**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param boolean $immediatly defers the execution if set to false
105 105
 	 * @return string
106 106
 	 */
107
-	public function after($to, $element, $immediatly=false){
108
-		return $this->_genericCallElement('after',$to, $element, $immediatly);
107
+	public function after($to, $element, $immediatly=false) {
108
+		return $this->_genericCallElement('after', $to, $element, $immediatly);
109 109
 	}
110 110
 
111 111
 	/**
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 	 * @param boolean $immediatly defers the execution if set to false
116 116
 	 * @return string
117 117
 	 */
118
-	public function before($to, $element, $immediatly=false){
119
-		return $this->_genericCallElement('before',$to, $element, $immediatly);
118
+	public function before($to, $element, $immediatly=false) {
119
+		return $this->_genericCallElement('before', $to, $element, $immediatly);
120 120
 	}
121 121
 
122 122
 	/**
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 * @param string $value
145 145
 	 * @param boolean $immediatly defers the execution if set to false
146 146
 	 */
147
-	public function val($element='this',$value='',$immediatly=false){
148
-		return $this->_genericCallValue('val',$element,$value,$immediatly);
147
+	public function val($element='this', $value='', $immediatly=false) {
148
+		return $this->_genericCallValue('val', $element, $value, $immediatly);
149 149
 	}
150 150
 
151 151
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * @param boolean $immediatly defers the execution if set to false
156 156
 	 */
157 157
 	public function html($element='this', $value='', $immediatly=false) {
158
-		return $this->_genericCallValue('html',$element, $value, $immediatly);
158
+		return $this->_genericCallValue('html', $element, $value, $immediatly);
159 159
 	}
160 160
 
161 161
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 		$animations="\t\t\t";
176 176
 		if (\is_array($params)) {
177
-			foreach ( $params as $param => $value ) {
177
+			foreach ($params as $param => $value) {
178 178
 				$animations.=$param.': \''.$value.'\', ';
179 179
 			}
180 180
 		}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @return string
204 204
 	 */
205 205
 	public function append($to, $element, $immediatly=false) {
206
-		return $this->_genericCallElement('append',$to, $element, $immediatly);
206
+		return $this->_genericCallElement('append', $to, $element, $immediatly);
207 207
 	}
208 208
 
209 209
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return string
215 215
 	 */
216 216
 	public function prepend($to, $element, $immediatly=false) {
217
-		return $this->_genericCallElement('prepend',$to, $element, $immediatly);
217
+		return $this->_genericCallElement('prepend', $to, $element, $immediatly);
218 218
 	}
219 219
 
220 220
 	/**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return string
228 228
 	 */
229 229
 	public function fadeIn($element='this', $speed='', $callback='', $immediatly=false) {
230
-		return $this->_showHideWithEffect("fadeIn",$element,$speed,$callback,$immediatly);
230
+		return $this->_showHideWithEffect("fadeIn", $element, $speed, $callback, $immediatly);
231 231
 	}
232 232
 
233 233
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @return string
241 241
 	 */
242 242
 	public function fadeOut($element='this', $speed='', $callback='', $immediatly=false) {
243
-		return $this->_showHideWithEffect("fadeOut",$element,$speed,$callback,$immediatly);
243
+		return $this->_showHideWithEffect("fadeOut", $element, $speed, $callback, $immediatly);
244 244
 	}
245 245
 
246 246
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return string
254 254
 	 */
255 255
 	public function slideUp($element='this', $speed='', $callback='', $immediatly=false) {
256
-		return $this->_showHideWithEffect("slideUp",$element,$speed,$callback,$immediatly);
256
+		return $this->_showHideWithEffect("slideUp", $element, $speed, $callback, $immediatly);
257 257
 	}
258 258
 
259 259
 	/**
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 * @return string
266 266
 	 */
267 267
 	public function removeClass($element='this', $class='', $immediatly=false) {
268
-		return $this->_genericCallValue('removeClass',$element, $class, $immediatly);
268
+		return $this->_genericCallValue('removeClass', $element, $class, $immediatly);
269 269
 	}
270 270
 
271 271
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @return string
279 279
 	 */
280 280
 	public function slideDown($element='this', $speed='', $callback='', $immediatly=false) {
281
-		return $this->_showHideWithEffect("slideDown",$element,$speed,$callback,$immediatly);
281
+		return $this->_showHideWithEffect("slideDown", $element, $speed, $callback, $immediatly);
282 282
 	}
283 283
 
284 284
 	/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @return string
292 292
 	 */
293 293
 	public function slideToggle($element='this', $speed='', $callback='', $immediatly=false) {
294
-		return $this->_showHideWithEffect("slideToggle",$element,$speed,$callback,$immediatly);
294
+		return $this->_showHideWithEffect("slideToggle", $element, $speed, $callback, $immediatly);
295 295
 	}
296 296
 
297 297
 	/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * @return string
305 305
 	 */
306 306
 	public function hide($element='this', $speed='', $callback='', $immediatly=false) {
307
-		return $this->_showHideWithEffect("hide",$element,$speed,$callback,$immediatly);
307
+		return $this->_showHideWithEffect("hide", $element, $speed, $callback, $immediatly);
308 308
 	}
309 309
 
310 310
 	/**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @return string
318 318
 	 */
319 319
 	public function toggle($element='this', $speed='', $callback='', $immediatly=false) {
320
-		return $this->_showHideWithEffect("toggle",$element,$speed,$callback,$immediatly);
320
+		return $this->_showHideWithEffect("toggle", $element, $speed, $callback, $immediatly);
321 321
 	}
322 322
 
323 323
 	/**
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @return string
330 330
 	 */
331 331
 	public function toggleClass($element='this', $class='', $immediatly=false) {
332
-		return $this->_genericCallValue('toggleClass',$element, $class, $immediatly);
332
+		return $this->_genericCallValue('toggleClass', $element, $class, $immediatly);
333 333
 	}
334 334
 
335 335
 	/**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	 * @return string
358 358
 	 */
359 359
 	public function show($element='this', $speed='', $callback='', $immediatly=false) {
360
-		return $this->_showHideWithEffect("show",$element,$speed,$callback,$immediatly);
360
+		return $this->_showHideWithEffect("show", $element, $speed, $callback, $immediatly);
361 361
 	}
362 362
 
363 363
 	/**
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
 	 */
370 370
 	public function sortable($element, $options=array()) {
371 371
 		if (count($options)>0) {
372
-			$sort_options=array ();
373
-			foreach ( $options as $k => $v ) {
372
+			$sort_options=array();
373
+			foreach ($options as $k => $v) {
374 374
 				$sort_options[]="\n\t\t".$k.': '.$v."";
375 375
 			}
376 376
 			$sort_options=implode(",", $sort_options);
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
 	 * @param boolean $immediatly
468 468
 	 * @return string
469 469
 	 */
470
-	private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) {
471
-		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly);
470
+	private function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) {
471
+		return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly);
472 472
 	}
473 473
 
474 474
 	/**
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 		$preventDefault=false;
487 487
 		$immediatly=true;
488 488
 		extract($parameters);
489
-		return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly);
489
+		return $this->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly);
490 490
 	}
491 491
 
492 492
 	/**
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		$preventDefault=false;
528 528
 		$immediatly=true;
529 529
 		extract($parameters);
530
-		$script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation,$immediatly);
530
+		$script=$this->_add_event($element, $this->exec($js), $event, $preventDefault, $stopPropagation, $immediatly);
531 531
 		return $script;
532 532
 	}
533 533
 	
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 	 * @param string $element The element selector
537 537
 	 * @param array $parameters default : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true)
538 538
 	 */
539
-	public function setDraggable($element,$parameters=[]){
539
+	public function setDraggable($element, $parameters=[]) {
540 540
 		$attr="id";
541 541
 		extract($parameters);
542
-		$script=$this->_add_event($element, Javascript::draggable($attr), "dragstart",$parameters);
542
+		$script=$this->_add_event($element, Javascript::draggable($attr), "dragstart", $parameters);
543 543
 		return $script;
544 544
 	}
545 545
 	
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
 	 * @param array $parameters default : array("attr"=>"id","stopPropagation"=>false,"immediatly"=>true,"jqueryDone"=>"append")
550 550
 	 * @param string $jsCallback the js script to call when element is dropped
551 551
 	 */
552
-	public function asDropZone($element,$jsCallback="",$parameters=[]){
552
+	public function asDropZone($element, $jsCallback="", $parameters=[]) {
553 553
 		$stopPropagation=false;
554 554
 		$immediatly=true;
555 555
 		$jqueryDone="append";
556
-		$script=$this->_add_event($element, '', "dragover",true,$stopPropagation,$immediatly);
556
+		$script=$this->_add_event($element, '', "dragover", true, $stopPropagation, $immediatly);
557 557
 		extract($parameters);
558
-		$script.=$this->_add_event($element, Javascript::dropZone($jqueryDone,$jsCallback), "drop",true,$stopPropagation,$immediatly);
558
+		$script.=$this->_add_event($element, Javascript::dropZone($jqueryDone, $jsCallback), "drop", true, $stopPropagation, $immediatly);
559 559
 		return $script;
560 560
 	}
561 561
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function getColCount(){
35
+	public function getColCount() {
36 36
 		return $this->count();
37 37
 	}
38 38
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @return HtmlTD
54 54
 	 */
55
-	public function getItem($index){
55
+	public function getItem($index) {
56 56
 		return parent::getItem($index);
57 57
 	}
58 58
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @param mixed $values
76 76
 	 */
77 77
 	public function setValues($values=array()) {
78
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);});
78
+		return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->setValue($value); });
79 79
 	}
80 80
 
81 81
 	/**
@@ -83,27 +83,27 @@  discard block
 block discarded – undo
83 83
 	 * @param mixed $values
84 84
 	 */
85 85
 	public function addValues($values=array()) {
86
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);});
86
+		return $this->_addOrSetValues($values, function(HtmlTD &$cell, $value) {$cell->addValue($value); });
87 87
 	}
88 88
 
89 89
 	/**
90 90
 	 * Sets or adds values to the row cols
91 91
 	 * @param mixed $values
92 92
 	 */
93
-	protected function _addOrSetValues($values,$callback) {
93
+	protected function _addOrSetValues($values, $callback) {
94 94
 		$count=$this->count();
95 95
 		if (!\is_array($values)) {
96 96
 			$values=\array_fill(0, $count, $values);
97 97
 		} else {
98
-			if (JArray::isAssociative($values) === true) {
98
+			if (JArray::isAssociative($values)===true) {
99 99
 				$values=\array_values($values);
100 100
 			}
101 101
 		}
102 102
 		$count=\min(\sizeof($values), $count);
103 103
 
104
-		for($i=0; $i < $count; $i++) {
104
+		for ($i=0; $i<$count; $i++) {
105 105
 			$cell=$this->content[$i];
106
-			$callback($cell,$values[$i]);
106
+			$callback($cell, $values[$i]);
107 107
 		}
108 108
 		return $this;
109 109
 	}
@@ -127,24 +127,24 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	public function getColPosition($colIndex) {
130
-		if($this->_container->_isMerged()!==true)
130
+		if ($this->_container->_isMerged()!==true)
131 131
 			return $colIndex;
132 132
 		$pos=0;
133 133
 		$rows=$this->_container->getContent();
134
-		for($i=0; $i < $this->_row; $i++) {
134
+		for ($i=0; $i<$this->_row; $i++) {
135 135
 			$max=\min($colIndex, $rows[$i]->count());
136
-			for($j=0; $j < $max; $j++) {
136
+			for ($j=0; $j<$max; $j++) {
137 137
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
138
-				if ($rowspan + $i > $this->_row)
138
+				if ($rowspan+$i>$this->_row)
139 139
 					$pos++;
140 140
 			}
141 141
 		}
142
-		if ($pos > $colIndex)
142
+		if ($pos>$colIndex)
143 143
 			return NULL;
144 144
 		$count=$this->count();
145
-		for($i=0; $i < $count; $i++) {
145
+		for ($i=0; $i<$count; $i++) {
146 146
 			$pos+=$this->content[$i]->getColspan();
147
-			if ($pos >= $colIndex + 1)
147
+			if ($pos>=$colIndex+1)
148 148
 				return $i;
149 149
 		}
150 150
 		return null;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
 	public function conditionalCellFormat($callback, $format) {
154 154
 		$cells=$this->content;
155
-		foreach ( $cells as $cell ) {
155
+		foreach ($cells as $cell) {
156 156
 			$cell->conditionalCellFormat($callback, $format);
157 157
 		}
158 158
 		return $this;
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 
168 168
 	public function containsStr($needle) {
169 169
 		$cells=$this->content;
170
-		foreach ( $cells as $cell ) {
171
-			if (\strpos($cell->getContent(), $needle) !== false)
170
+		foreach ($cells as $cell) {
171
+			if (\strpos($cell->getContent(), $needle)!==false)
172 172
 				return true;
173 173
 		}
174 174
 		return false;
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 
182 182
 	public function applyCells($callback) {
183 183
 		$cells=$this->content;
184
-		foreach ( $cells as $cell ) {
184
+		foreach ($cells as $cell) {
185 185
 			$cell->apply($callback);
186 186
 		}
187 187
 		return $this;
188 188
 	}
189 189
 
190
-	public function toDelete($colIndex){
190
+	public function toDelete($colIndex) {
191 191
 		$this->getItem($colIndex)->toDelete();
192 192
 		return $this;
193 193
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlBreadcrumb.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 		$this->startIndex=$startIndex;
53 53
 		$this->autoActive=$autoActive;
54 54
 		$this->_contentSeparator="<div class='divider'> / </div>";
55
-		$this->_hrefFunction=function (HtmlSemDoubleElement $e) {
55
+		$this->_hrefFunction=function(HtmlSemDoubleElement $e) {
56 56
 			return $e->getContent();
57 57
 		};
58 58
 		if (isset($hrefFunction)) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return HtmlBreadcrumb
69 69
 	 */
70 70
 	public function autoGetOnClick($targetSelector) {
71
-		return $this->getOnClick($this->root, $targetSelector, array ("attr" => $this->attr ));
71
+		return $this->getOnClick($this->root, $targetSelector, array("attr" => $this->attr));
72 72
 	}
73 73
 
74 74
 	public function contentAsString() {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setActive($index=null) {
85 85
 		if (!isset($index)) {
86
-			$index=sizeof($this->content) - 1;
86
+			$index=sizeof($this->content)-1;
87 87
 		}
88 88
 		$activeItem=$this->content[$index];
89 89
 		$activeItem->addToProperty("class", "active");
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @param object $dispatcher the request dispatcher
97 97
 	 * @return HtmlBreadcrumb
98 98
 	 */
99
-	public function fromDispatcher(JsUtils $js,$dispatcher, $startIndex=0) {
99
+	public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0) {
100 100
 		$this->startIndex=$startIndex;
101 101
 		return $this->addItems($js->fromDispatcher($dispatcher));
102 102
 	}
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
 		if (!isset($index)) {
112 112
 			$index=sizeof($this->content);
113 113
 		}
114
-		if ($this->absolutePaths === true) {
114
+		if ($this->absolutePaths===true) {
115 115
 			return $this->_hrefFunction($this->content[$index]);
116 116
 		} else {
117
-			return $this->root . implode($separator, array_slice(array_map(function ($e) {
117
+			return $this->root.implode($separator, array_slice(array_map(function($e) {
118 118
 				return $this->_hrefFunction($e);
119
-			}, $this->content), $this->startIndex, $index + 1));
119
+			}, $this->content), $this->startIndex, $index+1));
120 120
 		}
121 121
 	}
122 122
 
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 			$this->setActive();
151 151
 		}
152 152
 		$count=$this->count();
153
-		for($i=1; $i < $count; $i++) {
154
-			$this->content[$i]->wrap($this->getContentDivider($i - 1));
153
+		for ($i=1; $i<$count; $i++) {
154
+			$this->content[$i]->wrap($this->getContentDivider($i-1));
155 155
 		}
156 156
 		return parent::compile($js, $view);
157 157
 	}
@@ -161,15 +161,15 @@  discard block
 block discarded – undo
161 161
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
162 162
 	 */
163 163
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
164
-		foreach ( $this->content as $element ) {
164
+		foreach ($this->content as $element) {
165 165
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
166 166
 		}
167 167
 		return $this;
168 168
 	}
169 169
 
170 170
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
171
-		foreach ( $this->content as $element ) {
172
-			if ($element->getProperty($this->attr) != NULL){
171
+		foreach ($this->content as $element) {
172
+			if ($element->getProperty($this->attr)!=NULL) {
173 173
 				$element->_ajaxOn($operation, $event, $url, $responseElement, $parameters);
174 174
 			}
175 175
 		}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function createItem($value) {
186 186
 		$count=$this->count();
187
-		$itemO=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "a", "section");
187
+		$itemO=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "a", "section");
188 188
 		if (\is_array($value))
189 189
 			$itemO->fromArray($value);
190 190
 		else {
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	public function addIconAt($icon, $index) {
197 197
 		$item=$this->getItem($index);
198 198
 		if (isset($item)) {
199
-			$icon=new HtmlIcon("icon-" . $this->identifier, $icon);
199
+			$icon=new HtmlIcon("icon-".$this->identifier, $icon);
200 200
 			$item->wrapContent($icon);
201 201
 		}
202 202
 	}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	public function addItem($item) {
205 205
 		$count=$this->count();
206 206
 		$itemO=parent::addItem($item);
207
-		$this->addToPropertyCtrl("class", "section", array ("section" ));
207
+		$this->addToPropertyCtrl("class", "section", array("section"));
208 208
 		$itemO->setProperty($this->attr, $this->getHref($count));
209 209
 		return $itemO;
210 210
 	}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	public function setAbsolutePaths($absolutePaths) {
221 221
 		$this->absolutePaths=$absolutePaths;
222 222
 		$size=\sizeof($this->content);
223
-		for($i=0;$i<$size;$i++){
223
+		for ($i=0; $i<$size; $i++) {
224 224
 			$this->content[$i]->setProperty($this->attr, $this->getHref($i));
225 225
 		}
226 226
 		return $this;
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  * @version 1.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 	protected $_template;
20 20
 	protected $tagName;
21
-	protected $_wrapBefore=array ();
22
-	protected $_wrapAfter=array ();
21
+	protected $_wrapBefore=array();
22
+	protected $_wrapAfter=array();
23 23
 	protected $_bsComponent;
24 24
 	protected $_compiled=false;
25 25
 	protected $_postCompile;
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	abstract public function run(JsUtils $js);
34 34
 
35
-	private function _callSetter($setter,$key,$value,&$array){
35
+	private function _callSetter($setter, $key, $value, &$array) {
36 36
 		$result=false;
37
-		if (method_exists($this, $setter) && substr($setter, 0, 1) !== "_") {
37
+		if (method_exists($this, $setter) && substr($setter, 0, 1)!=="_") {
38 38
 			try {
39 39
 				$this->$setter($value);
40 40
 				unset($array[$key]);
41 41
 				$result=true;
42
-			} catch ( \Exception $e ) {
42
+			}catch (\Exception $e) {
43 43
 				$result=false;
44 44
 			}
45 45
 		}
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	protected function getTemplate(JsUtils $js=NULL) {
50
-		return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js);
50
+		return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js);
51 51
 	}
52 52
 
53 53
 	protected function ctrl($name, $value, $typeCtrl) {
54 54
 		if (\is_array($typeCtrl)) {
55
-			if (array_search($value, $typeCtrl) === false) {
56
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
55
+			if (array_search($value, $typeCtrl)===false) {
56
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
57 57
 			}
58 58
 		} else {
59 59
 			if (!$typeCtrl($value)) {
60
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
60
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
61 61
 			}
62 62
 		}
63 63
 		return true;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
75 75
 		if (\is_array($typeCtrl)) {
76 76
 			$this->removeOldValues($name, $typeCtrl);
77
-			$name.=$separator . $value;
77
+			$name.=$separator.$value;
78 78
 		}
79 79
 		return $this;
80 80
 	}
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 		if (\is_array($typeCtrl)) {
87 87
 			$this->removeOldValues($name, $typeCtrl);
88 88
 		}
89
-		$name.=$separator . $value;
89
+		$name.=$separator.$value;
90 90
 		return $this;
91 91
 	}
92 92
 
93 93
 	protected function addToMember(&$name, $value, $separator=" ") {
94
-		$name=str_ireplace($value, "", $name) . $separator . $value;
94
+		$name=str_ireplace($value, "", $name).$separator.$value;
95 95
 		return $this;
96 96
 	}
97 97
 
@@ -102,18 +102,18 @@  discard block
 block discarded – undo
102 102
 		$oldValue=trim($oldValue);
103 103
 	}
104 104
 
105
-	protected function _getElementBy($callback,$elements){
105
+	protected function _getElementBy($callback, $elements) {
106 106
 		if (\is_array($elements)) {
107 107
 			$elements=\array_values($elements);
108 108
 			$flag=false;
109 109
 			$index=0;
110
-			while ( !$flag && $index < sizeof($elements) ) {
110
+			while (!$flag && $index<sizeof($elements)) {
111 111
 				if ($elements[$index] instanceof BaseHtml)
112 112
 					$flag=($callback($elements[$index]));
113 113
 					$index++;
114 114
 			}
115
-			if ($flag === true)
116
-				return $elements[$index - 1];
115
+			if ($flag===true)
116
+				return $elements[$index-1];
117 117
 		} elseif ($elements instanceof BaseHtml) {
118 118
 			if ($callback($elements))
119 119
 				return $elements;
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	}
142 142
 
143 143
 	public function fromArray($array) {
144
-		foreach ( $this as $key => $value ) {
145
-			if(array_key_exists($key, $array)===true)
146
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
144
+		foreach ($this as $key => $value) {
145
+			if (array_key_exists($key, $array)===true)
146
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
147 147
 		}
148
-		foreach ( $array as $key => $value ) {
149
-			if($this->_callSetter($key, $key, $value, $array)===false){
150
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
148
+		foreach ($array as $key => $value) {
149
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
150
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
151 151
 			}
152 152
 		}
153 153
 		return $array;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	public function fromDatabaseObjects($objects, $function) {
157 157
 		if (isset($objects)) {
158
-			foreach ( $objects as $object ) {
158
+			foreach ($objects as $object) {
159 159
 				$this->fromDatabaseObject($object, $function);
160 160
 			}
161 161
 		}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 
178 178
 	public function getElementById($identifier, $elements) {
179
-		return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements);
179
+		return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements);
180 180
 	}
181 181
 
182 182
 	public function getBsComponent() {
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
192
-		if(!$this->_compiled){
193
-			if(isset($js)){
192
+		if (!$this->_compiled) {
193
+			if (isset($js)) {
194 194
 				$beforeCompile=$js->getParam("beforeCompileHtml");
195
-				if(\is_callable($beforeCompile)){
196
-					$beforeCompile($this,$js,$view);
195
+				if (\is_callable($beforeCompile)) {
196
+					$beforeCompile($this, $js, $view);
197 197
 				}
198 198
 			}
199
-			if(\is_callable($this->_preCompile)){
199
+			if (\is_callable($this->_preCompile)) {
200 200
 				$pc=$this->_preCompile;
201 201
 				$pc($this);
202 202
 			}
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 	}
207 207
 
208 208
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
209
-		$this->compile_once($js,$view);
209
+		$this->compile_once($js, $view);
210 210
 		$result=$this->getTemplate($js);
211
-		foreach ( $this as $key => $value ) {
212
-				if(\strstr($result, "%{$key}%")!==false){
211
+		foreach ($this as $key => $value) {
212
+				if (\strstr($result, "%{$key}%")!==false) {
213 213
 					if (\is_array($value)) {
214 214
 						$v=PropertyWrapper::wrap($value, $js);
215
-					}elseif($value instanceof \stdClass){
216
-							$v=\print_r($value,true);
217
-					}else{
215
+					}elseif ($value instanceof \stdClass) {
216
+							$v=\print_r($value, true);
217
+					} else {
218 218
 						$v=$value;
219 219
 					}
220 220
 					$result=str_replace("%{$key}%", $v, $result);
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 		}
223 223
 		if (isset($js)===true) {
224 224
 			$this->run($js);
225
-			if (isset($view) === true) {
225
+			if (isset($view)===true) {
226 226
 				$js->addViewElement($this->_identifier, $result, $view);
227 227
 			}
228 228
 		}
229 229
 
230
-		if(\is_callable($this->_postCompile)){
230
+		if (\is_callable($this->_postCompile)) {
231 231
 			$pc=$this->_postCompile;
232 232
 			$pc($this);
233 233
 		}
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 	 * @param array $parameters default: ["jsCallback"=>"","jqueryDone"=>"append"]
242 242
 	 * @return \Ajax\common\html\BaseHtml
243 243
 	 */
244
-	public function setDraggable($attr="id",$dropZone=null,$parameters=[]){
244
+	public function setDraggable($attr="id", $dropZone=null, $parameters=[]) {
245 245
 		$this->setProperty("draggable", "true");
246
-		$this->addEvent("dragstart",Javascript::draggable($attr));
247
-		if(isset($dropZone)&& $dropZone instanceof BaseHtml){
248
-			$jqueryDone="append";$jsCallback="";
246
+		$this->addEvent("dragstart", Javascript::draggable($attr));
247
+		if (isset($dropZone) && $dropZone instanceof BaseHtml) {
248
+			$jqueryDone="append"; $jsCallback="";
249 249
 			extract($parameters);
250
-			$dropZone->asDropZone($jsCallback,$jqueryDone,$parameters);
250
+			$dropZone->asDropZone($jsCallback, $jqueryDone, $parameters);
251 251
 		}
252 252
 		return $this;
253 253
 	}
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 	 * @param array $parameters
260 260
 	 * @return \Ajax\common\html\BaseHtml
261 261
 	 */
262
-	public function asDropZone($jsCallback="",$jqueryDone="append",$parameters=[]){
262
+	public function asDropZone($jsCallback="", $jqueryDone="append", $parameters=[]) {
263 263
 		$stopPropagation=false;
264
-		$this->addEvent("dragover", '', $stopPropagation,true);
264
+		$this->addEvent("dragover", '', $stopPropagation, true);
265 265
 		extract($parameters);
266
-		$this->addEvent("drop",Javascript::dropZone($jqueryDone,$jsCallback),$stopPropagation,true);
266
+		$this->addEvent("drop", Javascript::dropZone($jqueryDone, $jsCallback), $stopPropagation, true);
267 267
 		return $this;
268 268
 	}
269 269
 
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 		return $this->compile();
272 272
 	}
273 273
 
274
-	public function onPostCompile($callback){
274
+	public function onPostCompile($callback) {
275 275
 		$this->_postCompile=$callback;
276 276
 	}
277 277
 
278
-	public function onPreCompile($callback){
278
+	public function onPreCompile($callback) {
279 279
 		$this->_preCompile=$callback;
280 280
 	}
281 281
 }
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -14,44 +14,44 @@  discard block
 block discarded – undo
14 14
  */
15 15
 abstract class HtmlCollection extends HtmlDoubleElement {
16 16
 
17
-	public function __construct($identifier,$tagName="div"){
18
-		parent::__construct($identifier,$tagName);
17
+	public function __construct($identifier, $tagName="div") {
18
+		parent::__construct($identifier, $tagName);
19 19
 		$this->content=array();
20 20
 	}
21 21
 
22
-	public function addItems($items){
23
-		if(JArray::isAssociative($items)){
24
-			foreach ($items as $k=>$v){
25
-				$this->addItem([$k,$v]);
22
+	public function addItems($items) {
23
+		if (JArray::isAssociative($items)) {
24
+			foreach ($items as $k=>$v) {
25
+				$this->addItem([$k, $v]);
26 26
 			}
27
-		}else{
28
-			foreach ($items as $item){
27
+		} else {
28
+			foreach ($items as $item) {
29 29
 				$this->addItem($item);
30 30
 			}
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function setItems($items){
35
+	public function setItems($items) {
36 36
 		$this->content=$items;
37 37
 		return $this;
38 38
 	}
39 39
 
40
-	public function getItems(){
40
+	public function getItems() {
41 41
 		return $this->content;
42 42
 	}
43 43
 
44
-	protected function getItemToAdd($item){
44
+	protected function getItemToAdd($item) {
45 45
 		$itemO=$item;
46
-		if($this->createCondition($item)===true){
46
+		if ($this->createCondition($item)===true) {
47 47
 			$itemO=$this->createItem($item);
48 48
 		}
49 49
 		return $itemO;
50 50
 	}
51 51
 
52
-	protected function setItemIdentifier($item,$classname,$index){
53
-		if($item instanceof BaseWidget){
54
-			if(JString::isNull($item->getIdentifier())){
52
+	protected function setItemIdentifier($item, $classname, $index) {
53
+		if ($item instanceof BaseWidget) {
54
+			if (JString::isNull($item->getIdentifier())) {
55 55
 				$item->setIdentifier($classname."-".$this->identifier."-".$index);
56 56
 			}
57 57
 		}
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param HtmlDoubleElement|string|array $item
63 63
 	 * @return \Ajax\common\html\HtmlDoubleElement
64 64
 	 */
65
-	public function addItem($item){
65
+	public function addItem($item) {
66 66
 		$itemO=$this->getItemToAdd($item);
67 67
 		$this->addContent($itemO);
68 68
 		return $itemO;
69 69
 	}
70 70
 
71
-	public function insertItem($item,$position=0){
71
+	public function insertItem($item, $position=0) {
72 72
 		$itemO=$this->getItemToAdd($item);
73
-		\array_splice( $this->content, $position, 0, array($itemO));
73
+		\array_splice($this->content, $position, 0, array($itemO));
74 74
 		return $itemO;
75 75
 	}
76 76
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 		return $this;
94 94
 	}
95 95
 
96
-	public function removeItem($index){
96
+	public function removeItem($index) {
97 97
 		return array_splice($this->content, $index, 1);
98 98
 	}
99 99
 
100
-	public function count(){
100
+	public function count() {
101 101
 		return \sizeof($this->content);
102 102
 	}
103 103
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 		return $this->addItem($function($object));
109 109
 	}
110 110
 
111
-	public function apply($callBack){
112
-		foreach ($this->content as $item){
111
+	public function apply($callBack) {
112
+		foreach ($this->content as $item) {
113 113
 			$callBack($item);
114 114
 		}
115 115
 		return $this;
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	abstract protected function createItem($value);
131 131
 
132
-	protected function createCondition($value){
132
+	protected function createCondition($value) {
133 133
 		return \is_object($value)===false;
134 134
 	}
135 135
 
136
-	protected function contentAs($tagName){
137
-		foreach ($this->content as $item){
136
+	protected function contentAs($tagName) {
137
+		foreach ($this->content as $item) {
138 138
 			$item->setTagName($tagName);
139 139
 		}
140 140
 		return $this;
141 141
 	}
142 142
 
143
-	public function setProperties($properties){
143
+	public function setProperties($properties) {
144 144
 		$i=0;
145
-		foreach ($properties as $k=>$v){
145
+		foreach ($properties as $k=>$v) {
146 146
 			$c=$this->content[$i++];
147
-			if(isset($c))
148
-				$c->setProperty($k,$v);
147
+			if (isset($c))
148
+				$c->setProperty($k, $v);
149 149
 			else
150 150
 				return $this;
151 151
 		}
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 	 * @param array|mixed $values
159 159
 	 * @return $this
160 160
 	 */
161
-	public function setPropertyValues($property,$values){
161
+	public function setPropertyValues($property, $values) {
162 162
 		$i=0;
163
-		if(\is_array($values)===false){
164
-			$values=\array_fill(0, $this->count(),$values);
163
+		if (\is_array($values)===false) {
164
+			$values=\array_fill(0, $this->count(), $values);
165 165
 		}
166
-		foreach ($values as $value){
166
+		foreach ($values as $value) {
167 167
 			$c=$this->content[$i++];
168
-			if(isset($c)){
169
-				$c->setProperty($property,$value);
168
+			if (isset($c)) {
169
+				$c->setProperty($property, $value);
170 170
 			}
171
-			else{
171
+			else {
172 172
 				return $this;
173 173
 			}
174 174
 		}
@@ -181,17 +181,17 @@  discard block
 block discarded – undo
181 181
 	 * @param array|mixed $values
182 182
 	 * @return $this
183 183
 	 */
184
-	public function addPropertyValues($property,$values){
184
+	public function addPropertyValues($property, $values) {
185 185
 		$i=0;
186
-		if(\is_array($values)===false){
187
-			$values=\array_fill(0, $this->count(),$values);
186
+		if (\is_array($values)===false) {
187
+			$values=\array_fill(0, $this->count(), $values);
188 188
 		}
189
-		foreach ($values as $value){
189
+		foreach ($values as $value) {
190 190
 			$c=$this->content[$i++];
191
-			if(isset($c)){
192
-				$c->addToProperty($property,$value);
191
+			if (isset($c)) {
192
+				$c->addToProperty($property, $value);
193 193
 			}
194
-			else{
194
+			else {
195 195
 				return $this;
196 196
 			}
197 197
 		}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
202 202
 		$index=0;
203 203
 		$classname=\strtolower(JReflection::shortClassName($this));
204
-		foreach ($this->content as $item){
205
-			$this->setItemIdentifier($item,$classname,$index++);
204
+		foreach ($this->content as $item) {
205
+			$this->setItemIdentifier($item, $classname, $index++);
206 206
 		}
207
-		return parent::compile($js,$view);
207
+		return parent::compile($js, $view);
208 208
 	}
209 209
 
210
-	public function getItemById($identifier){
210
+	public function getItemById($identifier) {
211 211
 		return $this->getElementById($identifier, $this->content);
212 212
 	}
213 213
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	 * @param string $target
217 217
 	 * @return HtmlCollection
218 218
 	 */
219
-	public function asLinks($hrefs=[],$target=NUll) {
220
-		foreach ( $this->content as $index=>$item ) {
221
-			if($item instanceof HtmlDoubleElement){
219
+	public function asLinks($hrefs=[], $target=NUll) {
220
+		foreach ($this->content as $index=>$item) {
221
+			if ($item instanceof HtmlDoubleElement) {
222 222
 				$href="";
223
-				if(isset($hrefs[$index]))
223
+				if (isset($hrefs[$index]))
224 224
 					$href=$hrefs[$index];
225
-				$item->asLink($href,$target);
225
+				$item->asLink($href, $target);
226 226
 			}
227 227
 		}
228 228
 		return $this;
Please login to merge, or discard this patch.