Completed
Push — master ( a4feba...3ad5ef )
by Jean-Christophe
03:50
created
Ajax/common/Widget.php 2 patches
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -186,8 +186,9 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
188 188
 		$result=$this->addInToolbar($caption,$callback);
189
-		if(isset($icon))
190
-			$result->addIcon($icon);
189
+		if(isset($icon)) {
190
+					$result->addIcon($icon);
191
+		}
191 192
 		return $result;
192 193
 	}
193 194
 
@@ -201,7 +202,7 @@  discard block
 block discarded – undo
201 202
 			foreach ($items as $icon=>$item){
202 203
 				$this->addItemInToolbar($item,$icon,$callback);
203 204
 			}
204
-		}else{
205
+		} else{
205 206
 			foreach ($items as $item){
206 207
 				$this->addItemInToolbar($item,null,$callback);
207 208
 			}
@@ -352,8 +353,9 @@  discard block
 block discarded – undo
352 353
 	protected function _compileForm(){
353 354
 		if(isset($this->_form)){
354 355
 			$noValidate="";
355
-			if(\sizeof($this->_form->getValidationParams())>0)
356
-				$noValidate="novalidate";
356
+			if(\sizeof($this->_form->getValidationParams())>0) {
357
+							$noValidate="novalidate";
358
+			}
357 359
 			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
358 360
 		}
359 361
 	}
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\semantic\html\modules\HtmlModal;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait;
23
+	use FieldAsTrait, FormTrait;
24 24
 
25 25
 	/**
26 26
 	 * @var string classname
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	protected $_generated;
54 54
 
55 55
 
56
-	public function __construct($identifier,$model,$modelInstance=NULL) {
56
+	public function __construct($identifier, $model, $modelInstance=NULL) {
57 57
 		parent::__construct($identifier);
58 58
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
59 59
 		$this->setModel($model);
60
-		if(isset($modelInstance)){
60
+		if (isset($modelInstance)) {
61 61
 			$this->show($modelInstance);
62 62
 		}
63 63
 		$this->_generated=false;
64 64
 	}
65 65
 
66
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
66
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
67 67
 		$this->_instanceViewer=$instanceViewer;
68 68
 		$this->content=[$contentKey=>$content];
69 69
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
@@ -74,31 +74,31 @@  discard block
 block discarded – undo
74 74
 	 * @param int|string $fieldName
75 75
 	 * @return int|string
76 76
 	 */
77
-	protected function _getIndex($fieldName){
77
+	protected function _getIndex($fieldName) {
78 78
 		$index=$fieldName;
79
-		if(\is_string($fieldName)){
79
+		if (\is_string($fieldName)) {
80 80
 			$fields=$this->_instanceViewer->getVisibleProperties();
81 81
 			$index=\array_search($fieldName, $fields);
82 82
 		}
83 83
 		return $index;
84 84
 	}
85 85
 
86
-	protected function _getFieldIdentifier($prefix,$name=""){
86
+	protected function _getFieldIdentifier($prefix, $name="") {
87 87
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
88 88
 	}
89 89
 
90
-	protected function _getFieldName($index){
90
+	protected function _getFieldName($index) {
91 91
 		return $this->_instanceViewer->getFieldName($index);
92 92
 	}
93 93
 
94
-	protected function _getFieldCaption($index){
94
+	protected function _getFieldCaption($index) {
95 95
 		return $this->_instanceViewer->getCaption($index);
96 96
 	}
97 97
 
98
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
98
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
99 99
 
100
-	public function show($modelInstance){
101
-		if(\is_array($modelInstance)){
100
+	public function show($modelInstance) {
101
+		if (\is_array($modelInstance)) {
102 102
 			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
103 103
 		}
104 104
 		$this->_modelInstance=$modelInstance;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 	abstract public function getHtmlComponent();
126 126
 
127
-	public function setAttached($value=true){
127
+	public function setAttached($value=true) {
128 128
 		return $this->getHtmlComponent()->setAttached($value);
129 129
 	}
130 130
 
@@ -135,66 +135,66 @@  discard block
 block discarded – undo
135 135
 	 * @param callable $callback function called after the field compilation
136 136
 	 * @return Widget
137 137
 	 */
138
-	public function afterCompile($index,$callback){
138
+	public function afterCompile($index, $callback) {
139 139
 		$index=$this->_getIndex($index);
140 140
 		$this->_instanceViewer->afterCompile($index, $callback);
141 141
 		return $this;
142 142
 	}
143 143
 
144
-	public function setColor($color){
144
+	public function setColor($color) {
145 145
 		return $this->getHtmlComponent()->setColor($color);
146 146
 	}
147 147
 
148 148
 
149
-	public function setCaptions($captions){
149
+	public function setCaptions($captions) {
150 150
 		$this->_instanceViewer->setCaptions($captions);
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	public function setCaption($index,$caption){
154
+	public function setCaption($index, $caption) {
155 155
 		$this->_instanceViewer->setCaption($this->_getIndex($index), $caption);
156 156
 		return $this;
157 157
 	}
158 158
 
159
-	public function setFields($fields){
159
+	public function setFields($fields) {
160 160
 		$this->_instanceViewer->setVisibleProperties($fields);
161 161
 		return $this;
162 162
 	}
163 163
 
164
-	public function addField($field){
164
+	public function addField($field) {
165 165
 		$this->_instanceViewer->addField($field);
166 166
 		return $this;
167 167
 	}
168 168
 
169
-	public function addMessage($attributes=NULL,$fieldName="message"){
169
+	public function addMessage($attributes=NULL, $fieldName="message") {
170 170
 		$this->_instanceViewer->addField($fieldName);
171 171
 		$count=$this->_instanceViewer->visiblePropertiesCount();
172
-		return $this->fieldAsMessage($count-1,$attributes);
172
+		return $this->fieldAsMessage($count-1, $attributes);
173 173
 	}
174 174
 
175
-	public function addErrorMessage(){
176
-		return $this->addMessage(["error"=>true],"message");
175
+	public function addErrorMessage() {
176
+		return $this->addMessage(["error"=>true], "message");
177 177
 	}
178 178
 
179
-	public function insertField($index,$field){
179
+	public function insertField($index, $field) {
180 180
 		$index=$this->_getIndex($index);
181 181
 		$this->_instanceViewer->insertField($index, $field);
182 182
 		return $this;
183 183
 	}
184 184
 
185
-	public function insertInField($index,$field){
185
+	public function insertInField($index, $field) {
186 186
 		$index=$this->_getIndex($index);
187 187
 		$this->_instanceViewer->insertInField($index, $field);
188 188
 		return $this;
189 189
 	}
190 190
 
191
-	public function setValueFunction($index,$callback){
191
+	public function setValueFunction($index, $callback) {
192 192
 		$index=$this->_getIndex($index);
193 193
 		$this->_instanceViewer->setValueFunction($index, $callback);
194 194
 		return $this;
195 195
 	}
196 196
 
197
-	public function setIdentifierFunction($callback){
197
+	public function setIdentifierFunction($callback) {
198 198
 		$this->_instanceViewer->setIdentifierFunction($callback);
199 199
 		return $this;
200 200
 	}
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	/**
203 203
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
204 204
 	 */
205
-	public function getToolbar(){
206
-		if(isset($this->_toolbar)===false){
205
+	public function getToolbar() {
206
+		if (isset($this->_toolbar)===false) {
207 207
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
208 208
 		}
209 209
 		return $this->_toolbar;
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 	 * @param callable $callback function to call on $element
216 216
 	 * @return \Ajax\common\html\HtmlDoubleElement
217 217
 	 */
218
-	public function addInToolbar($element,$callback=NULL){
218
+	public function addInToolbar($element, $callback=NULL) {
219 219
 		$tb=$this->getToolbar();
220
-		if($element instanceof BaseWidget){
221
-			if($element->getIdentifier()===""){
220
+		if ($element instanceof BaseWidget) {
221
+			if ($element->getIdentifier()==="") {
222 222
 				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
223 223
 			}
224 224
 		}
225
-		if(isset($callback)){
226
-			if(\is_callable($callback)){
225
+		if (isset($callback)) {
226
+			if (\is_callable($callback)) {
227 227
 				$callback($element);
228 228
 			}
229 229
 		}
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @param callable $callback function($element)
237 237
 	 * @return \Ajax\common\html\HtmlDoubleElement
238 238
 	 */
239
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
240
-		$result=$this->addInToolbar($caption,$callback);
241
-		if(isset($icon))
239
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
240
+		$result=$this->addInToolbar($caption, $callback);
241
+		if (isset($icon))
242 242
 			$result->addIcon($icon);
243 243
 		return $result;
244 244
 	}
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 	 * @param callable $callback function($element)
249 249
 	 * @return \Ajax\common\Widget
250 250
 	 */
251
-	public function addItemsInToolbar(array $items,$callback=NULL){
252
-		if(JArray::isAssociative($items)){
253
-			foreach ($items as $icon=>$item){
254
-				$this->addItemInToolbar($item,$icon,$callback);
251
+	public function addItemsInToolbar(array $items, $callback=NULL) {
252
+		if (JArray::isAssociative($items)) {
253
+			foreach ($items as $icon=>$item) {
254
+				$this->addItemInToolbar($item, $icon, $callback);
255 255
 			}
256
-		}else{
257
-			foreach ($items as $item){
258
-				$this->addItemInToolbar($item,null,$callback);
256
+		} else {
257
+			foreach ($items as $item) {
258
+				$this->addItemInToolbar($item, null, $callback);
259 259
 			}
260 260
 		}
261 261
 		return $this;
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 	 * @param callable $callback function($element)
268 268
 	 * @return \Ajax\common\html\HtmlDoubleElement
269 269
 	 */
270
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
270
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
271 271
 		$dd=$value;
272 272
 		if (\is_string($value)) {
273
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
273
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
274 274
 		}
275
-		return $this->addInToolbar($dd,$callback);
275
+		return $this->addInToolbar($dd, $callback);
276 276
 	}
277 277
 
278 278
 	/**
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 	 * @param callable $callback function($element)
282 282
 	 * @return \Ajax\common\html\HtmlDoubleElement
283 283
 	 */
284
-	public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){
285
-		$bt=new HtmlButton("bt-".$caption,$caption,$cssStyle);
286
-		return $this->addInToolbar($bt,$callback);
284
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
285
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
286
+		return $this->addInToolbar($bt, $callback);
287 287
 	}
288 288
 
289 289
 	/**
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 * @param callable $callback function($element)
293 293
 	 * @return \Ajax\common\html\HtmlDoubleElement
294 294
 	 */
295
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
296
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
297
-		return $this->addInToolbar($bts,$callback);
295
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
296
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
297
+		return $this->addInToolbar($bts, $callback);
298 298
 	}
299 299
 
300 300
 	/**
@@ -304,15 +304,15 @@  discard block
 block discarded – undo
304 304
 	 * @param boolean $labeled
305 305
 	 * @return \Ajax\common\html\HtmlDoubleElement
306 306
 	 */
307
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
308
-		$bt=new HtmlButton("",$caption);
309
-		$bt->addIcon($icon,$before,$labeled);
307
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
308
+		$bt=new HtmlButton("", $caption);
309
+		$bt->addIcon($icon, $before, $labeled);
310 310
 		return $this->addInToolbar($bt);
311 311
 	}
312 312
 
313
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
314
-		$button=new HtmlButton($identifier,$value,$cssStyle);
315
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters);
313
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
314
+		$button=new HtmlButton($identifier, $value, $cssStyle);
315
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
316 316
 		return $this->addInToolbar($button);
317 317
 	}
318 318
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
343 343
 	 * @return \Ajax\common\Widget
344 344
 	 */
345
-	public function setDefaultValueFunction($defaultValueFunction){
345
+	public function setDefaultValueFunction($defaultValueFunction) {
346 346
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
347 347
 		return $this;
348 348
 	}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 * @param string|boolean $disable
352 352
 	 * @return string
353 353
 	 */
354
-	public function jsDisabled($disable=true){
354
+	public function jsDisabled($disable=true) {
355 355
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
356 356
 	}
357 357
 
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 	 * @param callable $callback function($element)
361 361
 	 * @return \Ajax\common\html\HtmlDoubleElement
362 362
 	 */
363
-	public function addEditButtonInToolbar($caption,$callback=NULL){
364
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
363
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
364
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
365 365
 		$bt->setToggle();
366 366
 		$bt->setActive($this->_edition);
367 367
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
368
-		return $this->addInToolbar($bt,$callback);
368
+		return $this->addInToolbar($bt, $callback);
369 369
 	}
370 370
 
371 371
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -379,35 +379,35 @@  discard block
 block discarded – undo
379 379
 	}
380 380
 
381 381
 	public function getForm() {
382
-		if(!isset($this->_form)){
382
+		if (!isset($this->_form)) {
383 383
 			$this->_form=new HtmlForm("frm-".$this->identifier);
384 384
 			$this->setEdition(true);
385 385
 		}
386 386
 		return $this->_form;
387 387
 	}
388 388
 
389
-	public function run(JsUtils $js){
389
+	public function run(JsUtils $js) {
390 390
 		$result=parent::run($js);
391
-		if(isset($this->_form)){
391
+		if (isset($this->_form)) {
392 392
 			$result=$this->runForm($js);
393 393
 		}
394 394
 		return $result;
395 395
 	}
396 396
 
397
-	protected function runForm(JsUtils $js){
397
+	protected function runForm(JsUtils $js) {
398 398
 		$fields=$this->getContentInstances(HtmlFormField::class);
399
-		foreach ($fields as $field){
399
+		foreach ($fields as $field) {
400 400
 			$this->_form->addField($field);
401 401
 		}
402 402
 		return $this->_form->run($js);
403 403
 	}
404 404
 
405
-	protected function _compileForm(){
406
-		if(isset($this->_form)){
405
+	protected function _compileForm() {
406
+		if (isset($this->_form)) {
407 407
 			$noValidate="";
408
-			if(\sizeof($this->_form->getValidationParams())>0)
408
+			if (\sizeof($this->_form->getValidationParams())>0)
409 409
 				$noValidate="novalidate";
410
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
410
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
411 411
 		}
412 412
 	}
413 413
 
@@ -416,26 +416,26 @@  discard block
 block discarded – undo
416 416
 		return $this;
417 417
 	}
418 418
 
419
-	public function moveFieldTo($from,$to){
419
+	public function moveFieldTo($from, $to) {
420 420
 		return $this->_instanceViewer->moveFieldTo($from, $to);
421 421
 	}
422 422
 
423
-	public function swapFields($index1,$index2){
423
+	public function swapFields($index1, $index2) {
424 424
 		$index1=$this->_getIndex($index1);
425 425
 		$index2=$this->_getIndex($index2);
426 426
 		return $this->_instanceViewer->swapFields($index1, $index2);
427 427
 	}
428 428
 
429
-	public function removeField($index){
429
+	public function removeField($index) {
430 430
 		$index=$this->_getIndex($index);
431 431
 		$this->_instanceViewer->removeField($index);
432 432
 		return $this;
433 433
 	}
434 434
 
435
-	public function asModal($header){
436
-		$modal=new HtmlModal("modal-".$this->identifier,$header);
435
+	public function asModal($header) {
436
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
437 437
 		$modal->setContent($this);
438
-		if(isset($this->_form)){
438
+		if (isset($this->_form)) {
439 439
 			$this->_form->onSuccess($modal->jsHide());
440 440
 		}
441 441
 		return $modal;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 2 patches
Braces   +25 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function addHeader($title, $niveau=1, $dividing=true) {
54 54
 		$header=new HtmlHeader("", $niveau, $title);
55
-		if ($dividing)
56
-			$header->setDividing();
55
+		if ($dividing) {
56
+					$header->setDividing();
57
+		}
57 58
 		return $this->addItem($header);
58 59
 	}
59 60
 
@@ -74,14 +75,16 @@  discard block
 block discarded – undo
74 75
 					if (\is_string($end)) {
75 76
 						$label=$end;
76 77
 						\array_pop($fields);
77
-					} else
78
-						$label=NULL;
78
+					} else {
79
+											$label=NULL;
80
+					}
79 81
 				}
80 82
 				$this->_fields=\array_merge($this->_fields, $fields);
81 83
 				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
82 84
 			}
83
-			if (isset($label))
84
-				$fields=new HtmlFormField("", $fields, $label);
85
+			if (isset($label)) {
86
+							$fields=new HtmlFormField("", $fields, $label);
87
+			}
85 88
 		} else {
86 89
 			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
87 90
 		}
@@ -134,27 +137,31 @@  discard block
 block discarded – undo
134 137
 	 */
135 138
 	public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) {
136 139
 		$message=new HtmlMessage($identifier, $content);
137
-		if (isset($header))
138
-			$message->addHeader($header);
139
-		if (isset($icon))
140
-			$message->setIcon($icon);
141
-		if (isset($type))
142
-			$message->setStyle($type);
140
+		if (isset($header)) {
141
+					$message->addHeader($header);
142
+		}
143
+		if (isset($icon)) {
144
+					$message->setIcon($icon);
145
+		}
146
+		if (isset($type)) {
147
+					$message->setStyle($type);
148
+		}
143 149
 		return $this->addItem($message);
144 150
 	}
145 151
 
146 152
 
147 153
 
148 154
 	public function compile(JsUtils $js=NULL,&$view=NULL){
149
-		if(\sizeof($this->_validationParams)>0)
150
-			$this->setProperty("novalidate", "");
155
+		if(\sizeof($this->_validationParams)>0) {
156
+					$this->setProperty("novalidate", "");
157
+		}
151 158
 		return parent::compile($js,$view);
152 159
 	}
153 160
 
154 161
 	public function run(JsUtils $js) {
155 162
 		if(isset($js)){
156 163
 			$compo=$js->semantic()->form("#".$this->identifier);
157
-		}else{
164
+		} else{
158 165
 			$compo=new Form();
159 166
 			$compo->attach("#".$this->identifier);
160 167
 		}
@@ -167,8 +174,9 @@  discard block
 block discarded – undo
167 174
 			if($field instanceof HtmlFormFields){
168 175
 				$items=$field->getItems();
169 176
 				foreach ($items as $_field){
170
-					if($_field instanceof HtmlFormField)
171
-						$compo=$this->addCompoValidation($compo, $_field);
177
+					if($_field instanceof HtmlFormField) {
178
+											$compo=$this->addCompoValidation($compo, $_field);
179
+					}
172 180
 				}
173 181
 			}
174 182
 		}
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class HtmlForm extends HtmlSemCollection {
23 23
 
24
-	use FieldsTrait,FormTrait;
24
+	use FieldsTrait, FormTrait;
25 25
 	/**
26 26
 	 * @var array
27 27
 	 */
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
 
35 35
 	public function __construct($identifier, $elements=array()) {
36 36
 		parent::__construct($identifier, "form", "ui form");
37
-		$this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ];
37
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
38 38
 		$this->setProperty("name", $this->identifier);
39
-		$this->_fields=array ();
39
+		$this->_fields=array();
40 40
 		$this->addItems($elements);
41 41
 		$this->_validationParams=[];
42 42
 	}
43 43
 
44
-	protected function getForm(){
44
+	protected function getForm() {
45 45
 		return $this;
46 46
 	}
47 47
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 * @param string $caption
63 63
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
64 64
 	 */
65
-	public function addDivider($caption=NULL){
66
-		return $this->addContent(new HtmlDivider("",$caption));
65
+	public function addDivider($caption=NULL) {
66
+		return $this->addContent(new HtmlDivider("", $caption));
67 67
 	}
68 68
 
69 69
 	public function addFields($fields=NULL, $label=NULL) {
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 						$label=NULL;
80 80
 				}
81 81
 				$this->_fields=\array_merge($this->_fields, $fields);
82
-				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
82
+				$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
83 83
 			}
84 84
 			if (isset($label))
85 85
 				$fields=new HtmlFormField("", $fields, $label);
86 86
 		} else {
87
-			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
87
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count());
88 88
 		}
89 89
 		$this->addItem($fields);
90 90
 		return $fields;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	public function addItem($item) {
94 94
 		$item=parent::addItem($item);
95
-		if (\is_subclass_of($item, HtmlFormField::class) === true) {
95
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
96 96
 			$this->_fields[]=$item;
97 97
 		}
98 98
 		return $item;
@@ -146,39 +146,39 @@  discard block
 block discarded – undo
146 146
 
147 147
 
148 148
 
149
-	public function compile(JsUtils $js=NULL,&$view=NULL){
150
-		if(\sizeof($this->_validationParams)>0)
149
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
150
+		if (\sizeof($this->_validationParams)>0)
151 151
 			$this->setProperty("novalidate", "");
152
-		return parent::compile($js,$view);
152
+		return parent::compile($js, $view);
153 153
 	}
154 154
 
155 155
 	public function run(JsUtils $js) {
156
-		if(isset($js)){
156
+		if (isset($js)) {
157 157
 			$compo=$js->semantic()->form("#".$this->identifier);
158
-		}else{
158
+		} else {
159 159
 			$compo=new Form();
160 160
 			$compo->attach("#".$this->identifier);
161 161
 		}
162
-		foreach ($this->_fields as $field){
163
-			if($field instanceof HtmlFormField){
162
+		foreach ($this->_fields as $field) {
163
+			if ($field instanceof HtmlFormField) {
164 164
 				$compo=$this->addCompoValidation($compo, $field);
165 165
 			}
166 166
 		}
167
-		foreach ($this->content as $field){
168
-			if($field instanceof HtmlFormFields){
167
+		foreach ($this->content as $field) {
168
+			if ($field instanceof HtmlFormFields) {
169 169
 				$items=$field->getItems();
170
-				foreach ($items as $_field){
171
-					if($_field instanceof HtmlFormField)
170
+				foreach ($items as $_field) {
171
+					if ($_field instanceof HtmlFormField)
172 172
 						$compo=$this->addCompoValidation($compo, $_field);
173 173
 				}
174 174
 			}
175 175
 		}
176
-		$this->_runValidationParams($compo,$js);
176
+		$this->_runValidationParams($compo, $js);
177 177
 		return $this->_bsComponent;
178 178
 	}
179 179
 
180
-	public function addValidationParam($paramName,$paramValue,$before="",$after=""){
181
-		$this->addBehavior($this->_validationParams, $paramName, $paramValue,$before,$after);
180
+	public function addValidationParam($paramName, $paramValue, $before="", $after="") {
181
+		$this->addBehavior($this->_validationParams, $paramName, $paramValue, $before, $after);
182 182
 		return $this;
183 183
 	}
184 184
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		return $this->_validationParams;
192 192
 	}
193 193
 
194
-	public function removeValidationParam($param){
194
+	public function removeValidationParam($param) {
195 195
 		unset($this->_validationParams[$param]);
196 196
 		return $this;
197 197
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/AttachedTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
 		if (isset($toElement)) {
17 17
 			$toElement->setAttached(true);
18 18
 		}
19
-		return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached"));
19
+		return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
20 20
 	}
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,15 +17,17 @@
 block discarded – undo
17 17
 
18 18
 	public function setBasic($very=false) {
19 19
 		$table=$this->getTable();
20
-		if ($very)
21
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
20
+		if ($very) {
21
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
22
+		}
22 23
 		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
23 24
 	}
24 25
 
25 26
 	public function setCompact($very=false) {
26 27
 		$table=$this->getTable();
27
-		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
28
+		if ($very) {
29
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
30
+		}
29 31
 		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
30 32
 	}
31 33
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Ajax\semantic\html\collections\table\traits;
3 3
 
4
-trait TableTrait{
4
+trait TableTrait {
5 5
 	/**
6 6
 	 * @return HtmlTable
7 7
 	 */
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
10 10
 	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
11 11
 
12
-	protected function addToPropertyTable($property,$value){
12
+	protected function addToPropertyTable($property, $value) {
13 13
 		return $this->getTable()->addToProperty($property, $value);
14 14
 	}
15 15
 
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 	public function setBasic($very=false) {
21 21
 		$table=$this->getTable();
22 22
 		if ($very)
23
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
24
-		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
23
+			$table->addToPropertyCtrl("class", "very", array("very"));
24
+		return $table->addToPropertyCtrl("class", "basic", array("basic"));
25 25
 	}
26 26
 
27 27
 	public function setCompact($very=false) {
28 28
 		$table=$this->getTable();
29 29
 		if ($very)
30
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
31
-		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
30
+			$table->addToPropertyCtrl("class", "very", array("very"));
31
+		return $table->addToPropertyCtrl("class", "compact", array("compact"));
32 32
 	}
33 33
 
34 34
 	public function setCollapsing() {
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 		return $this->addToPropertyTable("class", "striped");
68 68
 	}
69 69
 
70
-	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){
71
-		$this->onRowClick($jsCode,$stopPropagation,$preventDefault);
70
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
71
+		$this->onRowClick($jsCode, $stopPropagation, $preventDefault);
72 72
 	}
73 73
 
74
-	public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){
75
-		$this->getTable()->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault);
74
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
75
+		$this->getTable()->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault);
76 76
 	}
77 77
 
78
-	public function getOnRow($event, $url, $responseElement="", $parameters=array()){
79
-		$parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]);
80
-		return $this->getTable()->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters);
78
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
79
+		$parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]);
80
+		return $this->getTable()->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters);
81 81
 	}
82 82
 }
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
8 8
 
9
-	public static function containsCode($expression){
10
-		return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false;
9
+	public static function containsCode($expression) {
10
+		return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false;
11 11
 	}
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Ajax/common/html/HtmlSingleElement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function setClass($classNames) {
16
-		if(\is_array($classNames)){
16
+		if (\is_array($classNames)) {
17 17
 			$classNames=implode(" ", $classNames);
18 18
 		}
19 19
 		$this->setProperty("class", $classNames);
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	}
22 22
 
23 23
 	public function addClass($classNames) {
24
-		if(\is_array($classNames)){
24
+		if (\is_array($classNames)) {
25 25
 			$classNames=implode(" ", $classNames);
26 26
 		}
27 27
 		$this->addToProperty("class", $classNames);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function fromArray($array) {
54 54
 		$array=parent::fromArray($array);
55
-		foreach ( $array as $key => $value ) {
55
+		foreach ($array as $key => $value) {
56 56
 			$this->setProperty($key, $value);
57 57
 		}
58 58
 		return $array;
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlPropertiesTrait.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  * @author jc
9 9
  *
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->properties;
19 19
 	}
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 
40 40
 	public function addToProperty($name, $value, $separator=" ") {
41 41
 		if (\is_array($value)) {
42
-			foreach ( $value as $v ) {
42
+			foreach ($value as $v) {
43 43
 				$this->addToProperty($name, $v, $separator);
44 44
 			}
45
-		} else if ($value !== "" && $this->propertyContains($name, $value) === false) {
45
+		} else if ($value!=="" && $this->propertyContains($name, $value)===false) {
46 46
 			$v=@$this->properties[$name];
47
-			if (isset($v) && $v !== "")
48
-				$v=$v . $separator . $value;
47
+			if (isset($v) && $v!=="")
48
+				$v=$v.$separator.$value;
49 49
 				else
50 50
 					$v=$value;
51 51
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	public function addToPropertyCtrlCheck($name, $value, $typeCtrl) {
86
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
86
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
87 87
 			return $this->addToProperty($name, $value);
88 88
 		}
89 89
 		return $this;
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	protected function setPropertyCtrl($name, $value, $typeCtrl) {
107
-		if ($this->ctrl($name, $value, $typeCtrl) === true)
107
+		if ($this->ctrl($name, $value, $typeCtrl)===true)
108 108
 			return $this->setProperty($name, $value);
109 109
 			return $this;
110 110
 	}
111 111
 
112
-	protected function getElementByPropertyValue($propertyName,$value, $elements) {
113
-		return $this->_getElementBy(function($element) use ($propertyName,$value){return $element->propertyContains($propertyName, $value) === true;}, $elements);
112
+	protected function getElementByPropertyValue($propertyName, $value, $elements) {
113
+		return $this->_getElementBy(function($element) use ($propertyName, $value){return $element->propertyContains($propertyName, $value)===true; }, $elements);
114 114
 	}
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,8 +33,9 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	public function getProperty($name) {
36
-		if (array_key_exists($name, $this->properties))
37
-			return $this->properties[$name];
36
+		if (array_key_exists($name, $this->properties)) {
37
+					return $this->properties[$name];
38
+		}
38 39
 	}
39 40
 
40 41
 	public function addToProperty($name, $value, $separator=" ") {
@@ -44,10 +45,11 @@  discard block
 block discarded – undo
44 45
 			}
45 46
 		} else if ($value !== "" && $this->propertyContains($name, $value) === false) {
46 47
 			$v=@$this->properties[$name];
47
-			if (isset($v) && $v !== "")
48
-				$v=$v . $separator . $value;
49
-				else
50
-					$v=$value;
48
+			if (isset($v) && $v !== "") {
49
+							$v=$v . $separator . $value;
50
+			} else {
51
+									$v=$value;
52
+				}
51 53
 
52 54
 					return $this->setProperty($name, $v);
53 55
 		}
@@ -70,8 +72,9 @@  discard block
 block discarded – undo
70 72
 	}
71 73
 
72 74
 	protected function addToPropertyUnique($name, $value, $typeCtrl) {
73
-		if (@class_exists($typeCtrl, true))
74
-			$typeCtrl=$typeCtrl::getConstants();
75
+		if (@class_exists($typeCtrl, true)) {
76
+					$typeCtrl=$typeCtrl::getConstants();
77
+		}
75 78
 			if (\is_array($typeCtrl)) {
76 79
 				$this->removeOldValues($this->properties[$name], $typeCtrl);
77 80
 			}
@@ -90,8 +93,9 @@  discard block
 block discarded – undo
90 93
 	}
91 94
 
92 95
 	public function removeProperty($name) {
93
-		if (\array_key_exists($name, $this->properties))
94
-			unset($this->properties[$name]);
96
+		if (\array_key_exists($name, $this->properties)) {
97
+					unset($this->properties[$name]);
98
+		}
95 99
 			return $this;
96 100
 	}
97 101
 
@@ -104,8 +108,9 @@  discard block
 block discarded – undo
104 108
 	}
105 109
 
106 110
 	protected function setPropertyCtrl($name, $value, $typeCtrl) {
107
-		if ($this->ctrl($name, $value, $typeCtrl) === true)
108
-			return $this->setProperty($name, $value);
111
+		if ($this->ctrl($name, $value, $typeCtrl) === true) {
112
+					return $this->setProperty($name, $value);
113
+		}
109 114
 			return $this;
110 115
 	}
111 116
 
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 3 patches
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -55,6 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
 
57 57
 
58
+	/**
59
+	 * @param string $name
60
+	 * @param string[] $typeCtrl
61
+	 */
58 62
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
59 63
 		if ($this->ctrl($name, $value, $typeCtrl) === true) {
60 64
 			return $name=$value;
@@ -72,6 +76,10 @@  discard block
 block discarded – undo
72 76
 
73 77
 
74 78
 
79
+	/**
80
+	 * @param string $name
81
+	 * @param string[] $typeCtrl
82
+	 */
75 83
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
76 84
 		if ($this->ctrl($name, $value, $typeCtrl) === true) {
77 85
 			if (\is_array($typeCtrl)) {
@@ -82,6 +90,9 @@  discard block
 block discarded – undo
82 90
 		return $this;
83 91
 	}
84 92
 
93
+	/**
94
+	 * @param string $name
95
+	 */
85 96
 	protected function addToMember(&$name, $value, $separator=" ") {
86 97
 		$name=str_ireplace($value, "", $name) . $separator . $value;
87 98
 		return $this;
@@ -94,6 +105,9 @@  discard block
 block discarded – undo
94 105
 		$oldValue=trim($oldValue);
95 106
 	}
96 107
 
108
+	/**
109
+	 * @param \Closure $callback
110
+	 */
97 111
 	protected function _getElementBy($callback,$elements){
98 112
 		if (\is_array($elements)) {
99 113
 			$flag=false;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,15 +99,18 @@  discard block
 block discarded – undo
99 99
 			$flag=false;
100 100
 			$index=0;
101 101
 			while ( !$flag && $index < sizeof($elements) ) {
102
-				if ($elements[$index] instanceof BaseHtml)
103
-					$flag=($callback($elements[$index]));
102
+				if ($elements[$index] instanceof BaseHtml) {
103
+									$flag=($callback($elements[$index]));
104
+				}
104 105
 					$index++;
105 106
 			}
106
-			if ($flag === true)
107
-				return $elements[$index - 1];
107
+			if ($flag === true) {
108
+							return $elements[$index - 1];
109
+			}
108 110
 		} elseif ($elements instanceof BaseHtml) {
109
-			if ($callback($elements))
110
-				return $elements;
111
+			if ($callback($elements)) {
112
+							return $elements;
113
+			}
111 114
 		}
112 115
 		return null;
113 116
 	}
@@ -140,8 +143,9 @@  discard block
 block discarded – undo
140 143
 
141 144
 	public function fromArray($array) {
142 145
 		foreach ( $this as $key => $value ) {
143
-			if(array_key_exists($key, $array)===true)
144
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
146
+			if(array_key_exists($key, $array)===true) {
147
+							$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
148
+			}
145 149
 		}
146 150
 		foreach ( $array as $key => $value ) {
147 151
 			if($this->_callSetter($key, $key, $value, $array)===false){
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 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
 
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	abstract public function run(JsUtils $js);
32 32
 
33
-	private function _callSetter($setter,$key,$value,&$array){
33
+	private function _callSetter($setter, $key, $value, &$array) {
34 34
 		$result=false;
35 35
 		if (method_exists($this, $setter) && !JString::startswith($key, "_")) {
36 36
 			try {
37 37
 				$this->$setter($value);
38 38
 				unset($array[$key]);
39 39
 				$result=true;
40
-			} catch ( \Exception $e ) {
40
+			}catch (\Exception $e) {
41 41
 				$result=false;
42 42
 			}
43 43
 		}
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	protected function getTemplate(JsUtils $js=NULL) {
48
-		return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js);
48
+		return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js);
49 49
 	}
50 50
 
51 51
 	protected function ctrl($name, $value, $typeCtrl) {
52 52
 		if (\is_array($typeCtrl)) {
53
-			if (array_search($value, $typeCtrl) === false) {
54
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
53
+			if (array_search($value, $typeCtrl)===false) {
54
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
55 55
 			}
56 56
 		} else {
57 57
 			if (!$typeCtrl($value)) {
58
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
58
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
59 59
 			}
60 60
 		}
61 61
 		return true;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 
66 66
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
67
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
67
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
68 68
 			return $name=$value;
69 69
 		}
70 70
 		return $this;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
74 74
 		if (\is_array($typeCtrl)) {
75 75
 			$this->removeOldValues($name, $typeCtrl);
76
-			$name.=$separator . $value;
76
+			$name.=$separator.$value;
77 77
 		}
78 78
 		return $this;
79 79
 	}
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 
82 82
 
83 83
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
84
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
84
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
85 85
 			if (\is_array($typeCtrl)) {
86 86
 				$this->removeOldValues($name, $typeCtrl);
87 87
 			}
88
-			$name.=$separator . $value;
88
+			$name.=$separator.$value;
89 89
 		}
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,17 +102,17 @@  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
 			$flag=false;
108 108
 			$index=0;
109
-			while ( !$flag && $index < sizeof($elements) ) {
109
+			while (!$flag && $index<sizeof($elements)) {
110 110
 				if ($elements[$index] instanceof BaseHtml)
111 111
 					$flag=($callback($elements[$index]));
112 112
 					$index++;
113 113
 			}
114
-			if ($flag === true)
115
-				return $elements[$index - 1];
114
+			if ($flag===true)
115
+				return $elements[$index-1];
116 116
 		} elseif ($elements instanceof BaseHtml) {
117 117
 			if ($callback($elements))
118 118
 				return $elements;
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 	public function fromArray($array) {
143
-		foreach ( $this as $key => $value ) {
144
-			if(array_key_exists($key, $array)===true)
145
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
143
+		foreach ($this as $key => $value) {
144
+			if (array_key_exists($key, $array)===true)
145
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
146 146
 		}
147
-		foreach ( $array as $key => $value ) {
148
-			if($this->_callSetter($key, $key, $value, $array)===false){
149
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
147
+		foreach ($array as $key => $value) {
148
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
149
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
150 150
 			}
151 151
 		}
152 152
 		return $array;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
 	public function fromDatabaseObjects($objects, $function) {
156 156
 		if (isset($objects)) {
157
-			foreach ( $objects as $object ) {
157
+			foreach ($objects as $object) {
158 158
 				$this->fromDatabaseObject($object, $function);
159 159
 			}
160 160
 		}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 
177 177
 	public function getElementById($identifier, $elements) {
178
-		return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements);
178
+		return $this->_getElementBy(function($element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements);
179 179
 	}
180 180
 
181 181
 	public function getBsComponent() {
@@ -190,24 +190,24 @@  discard block
 block discarded – undo
190 190
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
191 191
 	}
192 192
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
193
-		if(!$this->_compiled){
194
-			$this->compile_once($js,$view);
193
+		if (!$this->_compiled) {
194
+			$this->compile_once($js, $view);
195 195
 			$this->_compiled=true;
196 196
 		}
197 197
 		$result=$this->getTemplate($js);
198
-		foreach ( $this as $key => $value ) {
199
-			if (JString::startswith($key, "_") === false && $key !== "events") {
198
+		foreach ($this as $key => $value) {
199
+			if (JString::startswith($key, "_")===false && $key!=="events") {
200 200
 				if (\is_array($value)) {
201 201
 					$v=PropertyWrapper::wrap($value, $js);
202 202
 				} else {
203 203
 					$v=$value;
204 204
 				}
205
-				$result=str_ireplace("%" . $key . "%", $v, $result);
205
+				$result=str_ireplace("%".$key."%", $v, $result);
206 206
 			}
207 207
 		}
208 208
 		if (isset($js)===true) {
209 209
 			$this->run($js);
210
-			if (isset($view) === true) {
210
+			if (isset($view)===true) {
211 211
 				$js->addViewElement($this->_identifier, $result, $view);
212 212
 			}
213 213
 		}
Please login to merge, or discard this patch.
Ajax/bootstrap/html/HtmlButtongroups.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -53,6 +53,9 @@  discard block
 block discarded – undo
53 53
 			$element->setStyle($value);
54 54
 	}
55 55
 
56
+	/**
57
+	 * @param HtmlDropdown $bt
58
+	 */
56 59
 	private function dropdownAsButton($bt) {
57 60
 		$this->addExistingDropDown($bt);
58 61
 		$bt->setTagName("button");
@@ -81,6 +84,9 @@  discard block
 block discarded – undo
81 84
 		return $result;
82 85
 	}
83 86
 
87
+	/**
88
+	 * @param integer $iid
89
+	 */
84 90
 	private function _addArrayElement(array $element,$iid){
85 91
 		if (array_key_exists("glyph", $element))
86 92
 			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @return HtmlButtongroups default : ""
40 40
 	 */
41 41
 	public function setSize($size) {
42
-		foreach ( $this->elements as $element ) {
42
+		foreach ($this->elements as $element) {
43 43
 			$element->setSize($size);
44 44
 		}
45 45
 		if (is_int($size)) {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setStyle($value) {
52
-		foreach ( $this->elements as $element )
52
+		foreach ($this->elements as $element)
53 53
 			$element->setStyle($value);
54 54
 	}
55 55
 
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
 	public function addElement($element) {
70 70
 		$result=$element;
71 71
 		$iid=sizeof($this->elements)+1;
72
-		if (($element instanceof HtmlDropdown)||($element instanceof HtmlSplitbutton)) {
72
+		if (($element instanceof HtmlDropdown) || ($element instanceof HtmlSplitbutton)) {
73 73
 			$this->addExistingDropDown($element);
74 74
 		} elseif (\is_array($element)) {
75
-			$result=$this->_addArrayElement($element,$iid);
75
+			$result=$this->_addArrayElement($element, $iid);
76 76
 		} elseif (is_string($element)) {
77
-			$result=new HtmlButton($this->identifier."-button-".$iid,$element);
77
+			$result=new HtmlButton($this->identifier."-button-".$iid, $element);
78 78
 		}
79
-		if($result instanceof HtmlButton)
79
+		if ($result instanceof HtmlButton)
80 80
 			$this->elements[]=$result;
81 81
 		return $result;
82 82
 	}
83 83
 
84
-	private function _addArrayElement(array $element,$iid){
84
+	private function _addArrayElement(array $element, $iid) {
85 85
 		if (array_key_exists("glyph", $element))
86 86
 			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
87 87
 		elseif (array_key_exists("btnCaption", $element)) {
88 88
 			if (array_key_exists("split", $element))
89 89
 				$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
90
-			else{
90
+			else {
91 91
 				$bt=new HtmlDropdown($this->identifier."-dropdown-".$iid);
92 92
 				$this->dropdownAsButton($bt);
93 93
 			}
94
-		} else{
94
+		} else {
95 95
 			$bt=new HtmlButton($this->identifier."-button-".$iid);
96 96
 			$bt->fromArray($element);
97 97
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	}
100 100
 
101 101
 	public function addElements($elements) {
102
-		foreach ( $elements as $element ) {
102
+		foreach ($elements as $element) {
103 103
 			$this->addElement($element);
104 104
 		}
105 105
 		return $this;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		} else
120 120
 			$value="btn-group-".$value;
121 121
 		if (strstr($value, "justified")) {
122
-			foreach ( $this->elements as $element ) {
122
+			foreach ($this->elements as $element) {
123 123
 				$element->wrap('<div class="btn-group" role="group">', '</div>');
124 124
 			}
125 125
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @see \Ajax\bootstrap\html\base\BaseHtml::on()
151 151
 	 */
152 152
 	public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
153
-		foreach ( $this->elements as $element ) {
153
+		foreach ($this->elements as $element) {
154 154
 			$element->on($event, $jsCode, $stopPropagation, $preventDefault);
155 155
 		}
156 156
 		return $this;
Please login to merge, or discard this patch.
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -49,8 +49,9 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setStyle($value) {
52
-		foreach ( $this->elements as $element )
53
-			$element->setStyle($value);
52
+		foreach ( $this->elements as $element ) {
53
+					$element->setStyle($value);
54
+		}
54 55
 	}
55 56
 
56 57
 	private function dropdownAsButton($bt) {
@@ -76,18 +77,19 @@  discard block
 block discarded – undo
76 77
 		} elseif (is_string($element)) {
77 78
 			$result=new HtmlButton($this->identifier."-button-".$iid,$element);
78 79
 		}
79
-		if($result instanceof HtmlButton)
80
-			$this->elements[]=$result;
80
+		if($result instanceof HtmlButton) {
81
+					$this->elements[]=$result;
82
+		}
81 83
 		return $result;
82 84
 	}
83 85
 
84 86
 	private function _addArrayElement(array $element,$iid){
85
-		if (array_key_exists("glyph", $element))
86
-			$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
87
-		elseif (array_key_exists("btnCaption", $element)) {
88
-			if (array_key_exists("split", $element))
89
-				$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
90
-			else{
87
+		if (array_key_exists("glyph", $element)) {
88
+					$bt=new HtmlGlyphButton($this->identifier."-button-".$iid);
89
+		} elseif (array_key_exists("btnCaption", $element)) {
90
+			if (array_key_exists("split", $element)) {
91
+							$bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid);
92
+			} else{
91 93
 				$bt=new HtmlDropdown($this->identifier."-dropdown-".$iid);
92 94
 				$this->dropdownAsButton($bt);
93 95
 			}
@@ -116,8 +118,9 @@  discard block
 block discarded – undo
116 118
 	public function setAlignment($value) {
117 119
 		if (is_int($value)) {
118 120
 			$value=CssRef::alignment("btn-group")[$value];
119
-		} else
120
-			$value="btn-group-".$value;
121
+		} else {
122
+					$value="btn-group-".$value;
123
+		}
121 124
 		if (strstr($value, "justified")) {
122 125
 			foreach ( $this->elements as $element ) {
123 126
 				$element->wrap('<div class="btn-group" role="group">', '</div>');
@@ -132,9 +135,9 @@  discard block
 block discarded – undo
132 135
 	 * @return HtmlButton
133 136
 	 */
134 137
 	public function getElement($index) {
135
-		if (is_int($index))
136
-			return $this->elements[$index];
137
-		else {
138
+		if (is_int($index)) {
139
+					return $this->elements[$index];
140
+		} else {
138 141
 			$elm=$this->getElementById($index, $this->elements);
139 142
 			return $elm;
140 143
 		}
Please login to merge, or discard this patch.