Passed
Push — master ( 6cf655...807644 )
by Jean-Christophe
02:16
created
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 	private $_activeRowSelector;
33 33
 
34
-	private $_focusable = false;
34
+	private $_focusable=false;
35 35
 
36 36
 	/**
37 37
 	 *
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
 
46 46
 	public function __construct($identifier, $rowCount, $colCount) {
47 47
 		parent::__construct($identifier, "table", "ui table");
48
-		$this->content = array();
48
+		$this->content=array();
49 49
 		$this->setRowCount($rowCount, $colCount);
50
-		$this->_variations = [
50
+		$this->_variations=[
51 51
 			Variation::CELLED,
52 52
 			Variation::PADDED,
53 53
 			Variation::COMPACT
54 54
 		];
55
-		$this->_compileParts = [
55
+		$this->_compileParts=[
56 56
 			"thead",
57 57
 			"tbody",
58 58
 			"tfoot"
59 59
 		];
60
-		$this->_afterCompileEvents = [];
60
+		$this->_afterCompileEvents=[];
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
 	 * @return HtmlTableContent
68 68
 	 */
69 69
 	public function getPart($key) {
70
-		if (\array_key_exists($key, $this->content) === false) {
71
-			$this->content[$key] = new HtmlTableContent("", $key);
72
-			if ($key !== "tbody") {
70
+		if (\array_key_exists($key, $this->content)===false) {
71
+			$this->content[$key]=new HtmlTableContent("", $key);
72
+			if ($key!=="tbody") {
73 73
 				$this->content[$key]->setRowCount(1, $this->_colCount);
74 74
 			}
75 75
 		}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return boolean
127 127
 	 */
128 128
 	public function hasPart($key) {
129
-		return \array_key_exists($key, $this->content) === true;
129
+		return \array_key_exists($key, $this->content)===true;
130 130
 	}
131 131
 
132 132
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return HtmlTableContent
137 137
 	 */
138 138
 	public function setRowCount($rowCount, $colCount) {
139
-		$this->_colCount = $colCount;
139
+		$this->_colCount=$colCount;
140 140
 		return $this->getBody()->setRowCount($rowCount, $colCount);
141 141
 	}
142 142
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param array $values
168 168
 	 * @return HtmlTR
169 169
 	 */
170
-	public function addRow($values = array()) {
171
-		$row = $this->getBody()->addRow($this->_colCount);
170
+	public function addRow($values=array()) {
171
+		$row=$this->getBody()->addRow($this->_colCount);
172 172
 		$row->setValues(\array_values($values));
173 173
 		return $row;
174 174
 	}
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 *        	values in an array of array
190 190
 	 * @return HtmlTable
191 191
 	 */
192
-	public function setValues($values = array()) {
192
+	public function setValues($values=array()) {
193 193
 		$this->getBody()->setValues($values);
194 194
 		return $this;
195 195
 	}
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param array $values
201 201
 	 * @return HtmlTableContent
202 202
 	 */
203
-	public function setHeaderValues($values = array()) {
203
+	public function setHeaderValues($values=array()) {
204 204
 		return $this->getHeader()->setValues($values);
205 205
 	}
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param array $values
211 211
 	 * @return HtmlTableContent
212 212
 	 */
213
-	public function setFooterValues($values = array()) {
213
+	public function setFooterValues($values=array()) {
214 214
 		return $this->getFooter()->setValues($values);
215 215
 	}
216 216
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 * @param array $values
222 222
 	 * @return HtmlTable
223 223
 	 */
224
-	public function setColValues($colIndex, $values = array()) {
224
+	public function setColValues($colIndex, $values=array()) {
225 225
 		$this->getBody()->setColValues($colIndex, $values);
226 226
 		return $this;
227 227
 	}
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 	 * @param array $values
234 234
 	 * @return HtmlTable
235 235
 	 */
236
-	public function setRowValues($rowIndex, $values = array()) {
236
+	public function setRowValues($rowIndex, $values=array()) {
237 237
 		$this->getBody()->setRowValues($rowIndex, $values);
238 238
 		return $this;
239 239
 	}
240 240
 
241
-	public function addColVariations($colIndex, $variations = array()) {
241
+	public function addColVariations($colIndex, $variations=array()) {
242 242
 		return $this->getBody()->addColVariations($colIndex, $variations);
243 243
 	}
244 244
 
@@ -305,19 +305,19 @@  discard block
 block discarded – undo
305 305
 	public function setColAlignment($colIndex, $alignment) {
306 306
 		switch ($alignment) {
307 307
 			case TextAlignment::LEFT:
308
-				$function = "colLeft";
308
+				$function="colLeft";
309 309
 				break;
310 310
 
311 311
 			case TextAlignment::RIGHT:
312
-				$function = "colRight";
312
+				$function="colRight";
313 313
 				break;
314 314
 
315 315
 			case TextAlignment::CENTER:
316
-				$function = "colCenter";
316
+				$function="colCenter";
317 317
 				break;
318 318
 
319 319
 			default:
320
-				$function = "colLeft";
320
+				$function="colLeft";
321 321
 		}
322 322
 		$this->colAlign($colIndex, $function);
323 323
 		return $this;
@@ -326,19 +326,19 @@  discard block
 block discarded – undo
326 326
 	public function setColAlignmentFromRight($colIndex, $alignment) {
327 327
 		switch ($alignment) {
328 328
 			case TextAlignment::LEFT:
329
-				$function = "colLeftFromRight";
329
+				$function="colLeftFromRight";
330 330
 				break;
331 331
 
332 332
 			case TextAlignment::RIGHT:
333
-				$function = "colRightFromRight";
333
+				$function="colRightFromRight";
334 334
 				break;
335 335
 
336 336
 			case TextAlignment::CENTER:
337
-				$function = "colCenterFromRight";
337
+				$function="colCenterFromRight";
338 338
 				break;
339 339
 
340 340
 			default:
341
-				$function = "colLeftFromRight";
341
+				$function="colLeftFromRight";
342 342
 		}
343 343
 		$this->colAlign($colIndex, $function);
344 344
 		return $this;
@@ -414,19 +414,19 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @see HtmlSemDoubleElement::compile()
416 416
 	 */
417
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
418
-		if (\sizeof($this->_compileParts) < 3) {
419
-			$this->_template = "%content%";
417
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
418
+		if (\sizeof($this->_compileParts)<3) {
419
+			$this->_template="%content%";
420 420
 			$this->refresh($js);
421 421
 		}
422
-		$this->content = JArray::sortAssociative($this->content, $this->_compileParts);
422
+		$this->content=JArray::sortAssociative($this->content, $this->_compileParts);
423 423
 		return parent::compile($js, $view);
424 424
 	}
425 425
 
426
-	protected function compile_once(JsUtils $js = NULL, &$view = NULL) {
426
+	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
427 427
 		parent::compile_once($js, $view);
428 428
 		if ($this->propertyContains("class", "sortable")) {
429
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
429
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
430 430
 		}
431 431
 	}
432 432
 
@@ -437,11 +437,11 @@  discard block
 block discarded – undo
437 437
 	 * @see BaseHtml::fromDatabaseObject()
438 438
 	 */
439 439
 	public function fromDatabaseObject($object, $function) {
440
-		$result = $function($object);
440
+		$result=$function($object);
441 441
 		if (\is_array($result)) {
442
-			$result = $this->addRow($function($object));
442
+			$result=$this->addRow($function($object));
443 443
 		} else {
444
-			$result = $this->getBody()->_addRow($result);
444
+			$result=$this->getBody()->_addRow($result);
445 445
 		}
446 446
 		if (isset($this->_afterCompileEvents["onNewRow"])) {
447 447
 			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
@@ -457,10 +457,10 @@  discard block
 block discarded – undo
457 457
 	 *        	array of thead,tbody,tfoot
458 458
 	 * @return HtmlTable
459 459
 	 */
460
-	public function setCompileParts($parts = [
460
+	public function setCompileParts($parts=[
461 461
 		"tbody"
462 462
 	]) {
463
-		$this->_compileParts = $parts;
463
+		$this->_compileParts=$parts;
464 464
 		return $this;
465 465
 	}
466 466
 
@@ -470,22 +470,22 @@  discard block
 block discarded – undo
470 470
 	}
471 471
 
472 472
 	public function refresh($js) {
473
-		$this->_footer = $this->getFooter();
473
+		$this->_footer=$this->getFooter();
474 474
 		if (isset($js)) {
475
-			$js->exec('$("#' . $this->identifier . ' tfoot").replaceWith("' . \addslashes($this->_footer) . '");', true);
475
+			$js->exec('$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");', true);
476 476
 		}
477 477
 	}
478 478
 
479 479
 	public function run(JsUtils $js) {
480
-		if (! $this->_runned) {
480
+		if (!$this->_runned) {
481 481
 			if (isset($this->_activeRowSelector)) {
482 482
 				$this->_activeRowSelector->run();
483 483
 			}
484 484
 		}
485
-		$result = parent::run($js);
485
+		$result=parent::run($js);
486 486
 		if (isset($this->_footer))
487 487
 			$this->_footer->run($js);
488
-		$this->_runned = true;
488
+		$this->_runned=true;
489 489
 		return $result;
490 490
 	}
491 491
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 * @return HtmlTable
498 498
 	 */
499 499
 	public function onNewRow($callback) {
500
-		$this->_afterCompileEvents["onNewRow"] = $callback;
500
+		$this->_afterCompileEvents["onNewRow"]=$callback;
501 501
 		return $this;
502 502
 	}
503 503
 
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	 * @param boolean $multiple
510 510
 	 * @return HtmlTable
511 511
 	 */
512
-	public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) {
513
-		$this->_activeRowSelector = new ActiveRow($this, $class, $event, $multiple);
512
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
513
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
514 514
 		return $this;
515 515
 	}
516 516
 
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
 	}
538 538
 
539 539
 	public function setColWidth($colIndex, $width) {
540
-		$part = $this->_getFirstPart();
541
-		if ($part !== null && $part->count() > 0)
540
+		$part=$this->_getFirstPart();
541
+		if ($part!==null && $part->count()>0)
542 542
 			$part->getCell(0, $colIndex)->setWidth($width);
543 543
 		return $this;
544 544
 	}
545 545
 
546 546
 	public function setColWidths($widths) {
547
-		$part = $this->_getFirstPart();
548
-		if ($part !== null && $part->count() > 0) {
549
-			$count = $part->getColCount();
550
-			if (! \is_array($widths)) {
551
-				$widths = \array_fill(0, $count, $widths);
547
+		$part=$this->_getFirstPart();
548
+		if ($part!==null && $part->count()>0) {
549
+			$count=$part->getColCount();
550
+			if (!\is_array($widths)) {
551
+				$widths=\array_fill(0, $count, $widths);
552 552
 			}
553
-			$max = \min(\sizeof($widths), $count);
554
-			for ($i = 0; $i < $max; $i ++) {
553
+			$max=\min(\sizeof($widths), $count);
554
+			for ($i=0; $i<$max; $i++) {
555 555
 				$part->getCell(0, $i)->setWidth($widths[$i]);
556 556
 			}
557 557
 		}
558 558
 		return $this;
559 559
 	}
560 560
 
561
-	public function mergeIdentiqualValues($colIndex, $function = "strip_tags") {
562
-		$body = $this->getBody();
561
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
562
+		$body=$this->getBody();
563 563
 		$body->mergeIdentiqualValues($colIndex, $function);
564 564
 		return $this;
565 565
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * @param mixed $_innerScript
578 578
 	 */
579 579
 	public function setInnerScript($_innerScript) {
580
-		$this->_innerScript = $_innerScript;
580
+		$this->_innerScript=$_innerScript;
581 581
 	}
582 582
 
583 583
 	public function onActiveRowChange($jsCode) {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 		return $this;
586 586
 	}
587 587
 
588
-	public function addMergeRow($colCount, $value = null) {
588
+	public function addMergeRow($colCount, $value=null) {
589 589
 		return $this->getBody()->addMergeRow($colCount, $value);
590 590
 	}
591 591
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  */
27 27
 class DataTable extends Widget {
28
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait;
28
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait;
29 29
 
30 30
 	protected $_searchField;
31 31
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 	protected $_displayBehavior;
43 43
 
44
-	protected $_visibleHover = false;
44
+	protected $_visibleHover=false;
45 45
 
46 46
 	protected $_targetSelector;
47 47
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 	protected $_json;
53 53
 
54
-	protected $_rowClass = "_element";
54
+	protected $_rowClass="_element";
55 55
 
56 56
 	protected $_sortable;
57 57
 
@@ -65,26 +65,26 @@  discard block
 block discarded – undo
65 65
 
66 66
 	protected $_namePrefix;
67 67
 
68
-	public function __construct($identifier, $model, $modelInstance = NULL) {
68
+	public function __construct($identifier, $model, $modelInstance=NULL) {
69 69
 		parent::__construct($identifier, $model, $modelInstance);
70 70
 		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
71
-		$this->_urls = [];
72
-		$this->_emptyMessage = new HtmlMessage("", "nothing to display");
71
+		$this->_urls=[];
72
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
73 73
 		$this->_emptyMessage->setIcon("info circle");
74 74
 	}
75 75
 
76 76
 	public function run(JsUtils $js) {
77
-		if ($this->_runned !== true) {
78
-			$offset = $js->scriptCount();
77
+		if ($this->_runned!==true) {
78
+			$offset=$js->scriptCount();
79 79
 			if ($this->_hasCheckboxes && isset($js)) {
80 80
 				$this->_runCheckboxes($js);
81 81
 			}
82 82
 			if ($this->_visibleHover) {
83
-				$js->execOn("mouseover", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
83
+				$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'visible');", [
84 84
 					"preventDefault" => false,
85 85
 					"stopPropagation" => true
86 86
 				]);
87
-				$js->execOn("mouseout", "#" . $this->identifier . " tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
87
+				$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.currentTarget).closest('tr').find('.visibleover').css('visibility', 'hidden');$(event.currentTarget).trigger('visibleoverOut');", [
88 88
 					"preventDefault" => false,
89 89
 					"stopPropagation" => true
90 90
 				]);
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 				$this->_associatePaginationBehavior($js, $offset);
102 102
 			}
103 103
 			$this->_associateSearchFieldBehavior($js, $offset);
104
-			$this->_runned = true;
104
+			$this->_runned=true;
105 105
 		}
106 106
 	}
107 107
 
108 108
 	protected function _generateBehavior($op, $params, JsUtils $js) {
109 109
 		if (isset($this->_urls[$op])) {
110
-			$params = \array_merge($params, [
110
+			$params=\array_merge($params, [
111 111
 				"attr" => "data-ajax"
112 112
 			]);
113
-			$js->ajaxOnClick("#" . $this->identifier . " ._" . $op, $this->_urls[$op], $this->getTargetSelector($op), $params);
113
+			$js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params);
114 114
 		}
115 115
 	}
116 116
 
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	public function refreshTD($fieldName, $jquery, $view) {
132
-		$index = $this->_getIndex($fieldName);
132
+		$index=$this->_getIndex($fieldName);
133 133
 		$this->compile($jquery, $view);
134 134
 		return $this->refreshTR()
135 135
 			->getTable()
136 136
 			->getCell(0, $index);
137 137
 	}
138 138
 
139
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
140
-		if (! $this->_generated) {
139
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
140
+		if (!$this->_generated) {
141 141
 			if (isset($this->_buttonsColumn)) {
142 142
 				$this->_instanceViewer->sortColumnContent($this->_buttonsColumn, $this->_buttons);
143 143
 			}
144 144
 			$this->_instanceViewer->setInstance($this->_model);
145
-			$captions = $this->_instanceViewer->getCaptions();
146
-			$table = $this->content["table"];
145
+			$captions=$this->_instanceViewer->getCaptions();
146
+			$table=$this->content["table"];
147 147
 			if ($this->_hasCheckboxes) {
148 148
 				$this->_generateMainCheckbox($captions);
149 149
 			}
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 			$this->compileExtraElements($table, $captions);
159 159
 			$this->_compileSearchFieldBehavior($js);
160 160
 
161
-			$this->content = JArray::sortAssociative($this->content, [
161
+			$this->content=JArray::sortAssociative($this->content, [
162 162
 				PositionInTable::BEFORETABLE,
163 163
 				"table",
164 164
 				PositionInTable::AFTERTABLE
165 165
 			]);
166
-			if ($this->_caption != null) {
166
+			if ($this->_caption!=null) {
167 167
 				$this->wrap("<div class='field'><label>{$this->_caption}</label>", "</div>");
168 168
 			}
169 169
 			$this->_compileForm();
170 170
 			$this->_applyStyleAttributes($table);
171
-			$this->_generated = true;
171
+			$this->_generated=true;
172 172
 		}
173 173
 		return parent::compile($js, $view);
174 174
 	}
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	}
207 207
 
208 208
 	protected function _generateHeader(HtmlTable $table, $captions) {
209
-		$gbFields = $this->_instanceViewer->getGroupByFields();
209
+		$gbFields=$this->_instanceViewer->getGroupByFields();
210 210
 		if (\is_array($gbFields)) {
211
-			$captions = \array_values(JArray::removeByKeys($captions, $gbFields));
211
+			$captions=\array_values(JArray::removeByKeys($captions, $gbFields));
212 212
 		}
213 213
 		$table->setHeaderValues($captions);
214 214
 		if (isset($this->_sortable)) {
@@ -217,22 +217,22 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	protected function _generateContent($table) {
220
-		$objects = $this->_modelInstance;
220
+		$objects=$this->_modelInstance;
221 221
 		if (isset($this->_pagination)) {
222
-			$objects = $this->_pagination->getObjects($this->_modelInstance);
222
+			$objects=$this->_pagination->getObjects($this->_modelInstance);
223 223
 		}
224 224
 		InstanceViewer::setIndex(0);
225
-		$fields = $this->_instanceViewer->getSimpleProperties();
226
-		$groupByFields = $this->_instanceViewer->getGroupByFields();
227
-		if (! \is_array($groupByFields)) {
228
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields) {
225
+		$fields=$this->_instanceViewer->getSimpleProperties();
226
+		$groupByFields=$this->_instanceViewer->getGroupByFields();
227
+		if (!\is_array($groupByFields)) {
228
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields) {
229 229
 				return $this->_generateRow($instance, $fields, $table);
230 230
 			});
231 231
 		} else {
232
-			$diffFields = \array_values(JArray::removeByKeys($fields, $groupByFields));
233
-			$activeValues = \array_combine($groupByFields, \array_fill(0, \count($groupByFields), null));
234
-			$uuids = [];
235
-			$table->fromDatabaseObjects($objects, function ($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) {
232
+			$diffFields=\array_values(JArray::removeByKeys($fields, $groupByFields));
233
+			$activeValues=\array_combine($groupByFields, \array_fill(0, \count($groupByFields), null));
234
+			$uuids=[];
235
+			$table->fromDatabaseObjects($objects, function($instance) use ($table, $fields, &$activeValues, $groupByFields, &$uuids, $diffFields) {
236 236
 				$this->_instanceViewer->setInstance($instance);
237 237
 				foreach ($groupByFields as $index => $gbField) {
238 238
 					$this->_generateGroupByRow($index, $gbField, $table, $fields, $activeValues, $uuids);
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 				return $this->_generateRow($instance, $diffFields, $table, null, $uuids);
241 241
 			});
242 242
 		}
243
-		if ($table->getRowCount() == 0) {
244
-			$result = $table->addRow();
243
+		if ($table->getRowCount()==0) {
244
+			$result=$table->addRow();
245 245
 			$result->mergeCol();
246 246
 			$result->setValues([
247 247
 				$this->_emptyMessage
@@ -250,20 +250,20 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	protected function _generateGroupByRow($index, $gbField, $table, $fields, &$activeValues, &$uuids) {
253
-		$newValue = $this->_instanceViewer->getValue($gbField);
254
-		if ($this->getElementContent($activeValues[$gbField]) !== $this->getElementContent($newValue)) {
255
-			if ($index == 0) {
256
-				$uuids = [];
253
+		$newValue=$this->_instanceViewer->getValue($gbField);
254
+		if ($this->getElementContent($activeValues[$gbField])!==$this->getElementContent($newValue)) {
255
+			if ($index==0) {
256
+				$uuids=[];
257 257
 			}
258
-			$uuid = \uniqid("grp");
259
-			$uuids[$gbField] = $uuid;
260
-			$id = $this->_instanceViewer->getIdentifier();
261
-			$result = $table->addMergeRow(\count($fields) + 1, $newValue);
262
-			$result->setIdentifier($this->identifier . "-tr-gb-" . $id);
258
+			$uuid=\uniqid("grp");
259
+			$uuids[$gbField]=$uuid;
260
+			$id=$this->_instanceViewer->getIdentifier();
261
+			$result=$table->addMergeRow(\count($fields)+1, $newValue);
262
+			$result->setIdentifier($this->identifier."-tr-gb-".$id);
263 263
 			$result->setProperty("data-ajax", $id);
264 264
 			$result->setProperty("data-group", $uuid);
265 265
 			$result->addToProperty("class", $this->_rowClass);
266
-			$activeValues[$gbField] = $newValue;
266
+			$activeValues[$gbField]=$newValue;
267 267
 		}
268 268
 	}
269 269
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	}
276 276
 
277 277
 	public function getFieldValue($index) {
278
-		$index = $this->_getIndex($index);
278
+		$index=$this->_getIndex($index);
279 279
 		if (\is_numeric($index)) {
280
-			$values = $this->_instanceViewer->getValues();
280
+			$values=$this->_instanceViewer->getValues();
281 281
 			if (isset($values[$index])) {
282 282
 				return $values[$index];
283 283
 			}
@@ -285,30 +285,30 @@  discard block
 block discarded – undo
285 285
 		return null;
286 286
 	}
287 287
 
288
-	protected function _generateRow($instance, $fields, &$table, $checkedClass = null, $uuids = null) {
288
+	protected function _generateRow($instance, $fields, &$table, $checkedClass=null, $uuids=null) {
289 289
 		$this->_instanceViewer->setInstance($instance);
290
-		InstanceViewer::$index ++;
291
-		$values = $this->_instanceViewer->getValues();
292
-		$id = $this->_instanceViewer->getIdentifier();
293
-		$dataAjax = $id;
294
-		$id = $this->cleanIdentifier($id);
290
+		InstanceViewer::$index++;
291
+		$values=$this->_instanceViewer->getValues();
292
+		$id=$this->_instanceViewer->getIdentifier();
293
+		$dataAjax=$id;
294
+		$id=$this->cleanIdentifier($id);
295 295
 		if ($this->_hasCheckboxes) {
296
-			$ck = new HtmlCheckbox("ck-" . $this->identifier . "-" . $id, "");
297
-			$checked = false;
296
+			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, "");
297
+			$checked=false;
298 298
 			if (isset($this->_checkedCallback)) {
299
-				$func = $this->_checkedCallback;
300
-				$checked = $func($instance);
299
+				$func=$this->_checkedCallback;
300
+				$checked=$func($instance);
301 301
 			}
302 302
 			$ck->setChecked($checked);
303
-			$field = $ck->getField();
303
+			$field=$ck->getField();
304 304
 			$field->setProperty("value", $dataAjax);
305 305
 			$field->setProperty("name", "selection[]");
306 306
 			if (isset($checkedClass))
307 307
 				$field->setClass($checkedClass);
308 308
 			\array_unshift($values, $ck);
309 309
 		}
310
-		$result = $table->newRow();
311
-		$result->setIdentifier($this->identifier . "-tr-" . $id);
310
+		$result=$table->newRow();
311
+		$result->setIdentifier($this->identifier."-tr-".$id);
312 312
 		$result->setProperty("data-ajax", $dataAjax);
313 313
 		$result->setValues($values);
314 314
 		$result->addToProperty("class", $this->_rowClass);
@@ -321,67 +321,67 @@  discard block
 block discarded – undo
321 321
 
322 322
 	protected function _generatePagination($table) {
323 323
 		if (isset($this->_toolbar)) {
324
-			if ($this->_toolbarPosition == PositionInTable::FOOTER)
324
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
325 325
 				$this->_toolbar->setFloated("left");
326 326
 		}
327
-		$footer = $table->getFooter();
327
+		$footer=$table->getFooter();
328 328
 		$footer->mergeCol();
329
-		$this->_paginationToolbar = $this->_pagination->generateMenu($this->identifier);
329
+		$this->_paginationToolbar=$this->_pagination->generateMenu($this->identifier);
330 330
 		$footer->addValues($this->_paginationToolbar);
331 331
 	}
332 332
 
333
-	protected function _associatePaginationBehavior(JsUtils $js = NULL, $offset = null) {
333
+	protected function _associatePaginationBehavior(JsUtils $js=NULL, $offset=null) {
334 334
 		if (isset($this->_urls["refresh"])) {
335
-			$menu = $this->_pagination->getMenu();
335
+			$menu=$this->_pagination->getMenu();
336 336
 			if (isset($menu) && isset($js)) {
337
-				$js->postOnClick("#" . $menu->getIdentifier() . " .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", $this->getRefreshSelector(), [
337
+				$js->postOnClick("#".$menu->getIdentifier()." .item", $this->_urls["refresh"], "{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}", $this->getRefreshSelector(), [
338 338
 					"preventDefault" => false,
339 339
 					"jqueryDone" => "replaceWith",
340 340
 					"hasLoader" => false,
341
-					"jsCallback" => '$("#' . $this->identifier . '").trigger("pageChange");$("#' . $this->identifier . '").trigger("activeRowChange");'
341
+					"jsCallback" => '$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");'
342 342
 				]);
343
-				$page = $_POST["p"] ?? null;
343
+				$page=$_POST["p"] ?? null;
344 344
 				if (isset($page)) {
345
-					$activeClass = $this->getActiveRowClass();
346
-					$js->execAtLast('$("#' . $this->getIdentifier() . ' .pagination").children("a.item").removeClass("' . $activeClass . '");$("#' . $this->getIdentifier() . ' .pagination").children("a.item[data-page=' . $page . ']:not(.no-active)").addClass("' . $activeClass . '");');
345
+					$activeClass=$this->getActiveRowClass();
346
+					$js->execAtLast('$("#'.$this->getIdentifier().' .pagination").children("a.item").removeClass("'.$activeClass.'");$("#'.$this->getIdentifier().' .pagination").children("a.item[data-page='.$page.']:not(.no-active)").addClass("'.$activeClass.'");');
347 347
 				}
348 348
 			}
349 349
 		}
350 350
 	}
351 351
 
352
-	protected function _compileSearchFieldBehavior(JsUtils $js = NULL) {
352
+	protected function _compileSearchFieldBehavior(JsUtils $js=NULL) {
353 353
 		if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) {
354
-			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'" . JString::doubleBackSlashes($this->_model) . "'}", "#" . $this->identifier . " tbody", [
354
+			$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}", "#".$this->identifier." tbody", [
355 355
 				"preventDefault" => false,
356 356
 				"jqueryDone" => "replaceWith",
357 357
 				"hasLoader" => "internal",
358
-				"jsCallback" => '$("#' . $this->identifier . '").trigger("searchTerminate",[$(self).val()]);'
358
+				"jsCallback" => '$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);'
359 359
 			]);
360 360
 		}
361 361
 	}
362 362
 
363
-	protected function _associateSearchFieldBehavior(JsUtils $js = NULL, $offset = null) {}
363
+	protected function _associateSearchFieldBehavior(JsUtils $js=NULL, $offset=null) {}
364 364
 
365 365
 	protected function _getFieldName($index) {
366
-		$fieldName = parent::_getFieldName($index);
366
+		$fieldName=parent::_getFieldName($index);
367 367
 		if (\is_object($fieldName))
368
-			$fieldName = "field-" . $index;
369
-		if ($this->_namePrefix != null) {
370
-			$fieldName = $this->_namePrefix . '.' . $fieldName;
368
+			$fieldName="field-".$index;
369
+		if ($this->_namePrefix!=null) {
370
+			$fieldName=$this->_namePrefix.'.'.$fieldName;
371 371
 		}
372
-		return $fieldName . "[]";
372
+		return $fieldName."[]";
373 373
 	}
374 374
 
375 375
 	protected function _getFieldCaption($index) {
376 376
 		return null;
377 377
 	}
378 378
 
379
-	protected function applyToolbarPosition(string $position, $table, $captions = NULL) {
379
+	protected function applyToolbarPosition(string $position, $table, $captions=NULL) {
380 380
 		switch ($position) {
381 381
 			case PositionInTable::BEFORETABLE:
382 382
 			case PositionInTable::AFTERTABLE:
383
-				if (isset($this->_compileParts) === false) {
384
-					$this->content[$position] = $this->_toolbar;
383
+				if (isset($this->_compileParts)===false) {
384
+					$this->content[$position]=$this->_toolbar;
385 385
 				}
386 386
 				break;
387 387
 			case PositionInTable::HEADER:
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		}
393 393
 	}
394 394
 
395
-	protected function _setToolbarPosition($table, $captions = NULL) {
395
+	protected function _setToolbarPosition($table, $captions=NULL) {
396 396
 		if (\is_array($this->_toolbarPosition)) {
397 397
 			foreach ($this->_toolbarPosition as $tbp) {
398 398
 				$this->applyToolbarPosition($tbp, $table, $captions);
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
 	}
419 419
 
420 420
 	private function addToolbarRow($part, $table, $captions) {
421
-		$hasPart = $table->hasPart($part);
421
+		$hasPart=$table->hasPart($part);
422 422
 		if ($hasPart) {
423
-			$row = $table->getPart($part)->addRow(\count($captions));
423
+			$row=$table->getPart($part)->addRow(\count($captions));
424 424
 		} else {
425
-			$row = $table->getPart($part)->getRow(0);
425
+			$row=$table->getPart($part)->getRow(0);
426 426
 		}
427 427
 		$row->mergeCol();
428 428
 		$row->setValues([
@@ -454,12 +454,12 @@  discard block
 block discarded – undo
454 454
 	 */
455 455
 	public function setUrls($urls) {
456 456
 		if (\is_array($urls)) {
457
-			$this->_urls["refresh"] = JArray::getValue($urls, "refresh", 0);
458
-			$this->_urls["edit"] = JArray::getValue($urls, "edit", 1);
459
-			$this->_urls["delete"] = JArray::getValue($urls, "delete", 2);
460
-			$this->_urls["display"] = JArray::getValue($urls, "display", 3);
457
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
458
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
459
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
460
+			$this->_urls["display"]=JArray::getValue($urls, "display", 3);
461 461
 		} else {
462
-			$this->_urls = [
462
+			$this->_urls=[
463 463
 				"refresh" => $urls,
464 464
 				"edit" => $urls,
465 465
 				"delete" => $urls,
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 *        	The number of visible pages in the Pagination component
483 483
 	 * @return DataTable
484 484
 	 */
485
-	public function paginate($page, $total_rowcount, $items_per_page = 10, $pages_visibles = null) {
486
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
485
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
486
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
487 487
 		return $this;
488 488
 	}
489 489
 
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
 	 *        	The number of visible pages in the Pagination component
499 499
 	 * @return DataTable
500 500
 	 */
501
-	public function autoPaginate($page = 1, $items_per_page = 10, $pages_visibles = 4) {
502
-		$this->_pagination = new Pagination($items_per_page, $pages_visibles, $page);
501
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
502
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
503 503
 		return $this;
504 504
 	}
505 505
 
@@ -508,10 +508,10 @@  discard block
 block discarded – undo
508 508
 	 * @param array $compileParts
509 509
 	 * @return DataTable
510 510
 	 */
511
-	public function refresh($compileParts = [
511
+	public function refresh($compileParts=[
512 512
 		'tbody'
513 513
 	]) {
514
-		$this->_compileParts = $compileParts;
514
+		$this->_compileParts=$compileParts;
515 515
 		return $this;
516 516
 	}
517 517
 
@@ -521,14 +521,14 @@  discard block
 block discarded – undo
521 521
 	 * @param string $position
522 522
 	 * @return \Ajax\common\html\HtmlDoubleElement
523 523
 	 */
524
-	public function addSearchInToolbar($position = Direction::RIGHT) {
524
+	public function addSearchInToolbar($position=Direction::RIGHT) {
525 525
 		return $this->addInToolbar($this->getSearchField())
526 526
 			->setPosition($position);
527 527
 	}
528 528
 
529 529
 	public function getSearchField() {
530
-		if (isset($this->_searchField) === false) {
531
-			$this->_searchField = new HtmlInput("search-" . $this->identifier, "search", "", "Search...");
530
+		if (isset($this->_searchField)===false) {
531
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
532 532
 			$this->_searchField->addIcon("search", Direction::RIGHT);
533 533
 		}
534 534
 		return $this->_searchField;
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 	}
557 557
 
558 558
 	protected function getTargetSelector($op) {
559
-		$result = $this->_targetSelector;
560
-		if (! isset($result[$op]))
561
-			$result = "#" . $this->identifier;
559
+		$result=$this->_targetSelector;
560
+		if (!isset($result[$op]))
561
+			$result="#".$this->identifier;
562 562
 		return $result[$op];
563 563
 	}
564 564
 
@@ -570,20 +570,20 @@  discard block
 block discarded – undo
570 570
 	 * @return DataTable
571 571
 	 */
572 572
 	public function setTargetSelector($_targetSelector) {
573
-		if (! \is_array($_targetSelector)) {
574
-			$_targetSelector = [
573
+		if (!\is_array($_targetSelector)) {
574
+			$_targetSelector=[
575 575
 				"edit" => $_targetSelector,
576 576
 				"delete" => $_targetSelector
577 577
 			];
578 578
 		}
579
-		$this->_targetSelector = $_targetSelector;
579
+		$this->_targetSelector=$_targetSelector;
580 580
 		return $this;
581 581
 	}
582 582
 
583 583
 	public function getRefreshSelector() {
584 584
 		if (isset($this->_refreshSelector))
585 585
 			return $this->_refreshSelector;
586
-		return "#" . $this->identifier . " tbody";
586
+		return "#".$this->identifier." tbody";
587 587
 	}
588 588
 
589 589
 	/**
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 * @return DataTable
593 593
 	 */
594 594
 	public function setRefreshSelector($_refreshSelector) {
595
-		$this->_refreshSelector = $_refreshSelector;
595
+		$this->_refreshSelector=$_refreshSelector;
596 596
 		return $this;
597 597
 	}
598 598
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 	public function show($modelInstance) {
605 605
 		if (\is_array($modelInstance)) {
606 606
 			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
607
-				$modelInstance = \json_decode(\json_encode($modelInstance), FALSE);
607
+				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
608 608
 		}
609
-		$this->_modelInstance = $modelInstance;
609
+		$this->_modelInstance=$modelInstance;
610 610
 	}
611 611
 
612 612
 	public function getRowClass() {
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @return DataTable
621 621
 	 */
622 622
 	public function setRowClass($_rowClass) {
623
-		$this->_rowClass = $_rowClass;
623
+		$this->_rowClass=$_rowClass;
624 624
 		return $this;
625 625
 	}
626 626
 
@@ -631,16 +631,16 @@  discard block
 block discarded – undo
631 631
 	 * @return DataTable
632 632
 	 */
633 633
 	public function setEmptyMessage($_emptyMessage) {
634
-		$this->_emptyMessage = $_emptyMessage;
634
+		$this->_emptyMessage=$_emptyMessage;
635 635
 		return $this;
636 636
 	}
637 637
 
638
-	public function setSortable($colIndex = NULL) {
639
-		$this->_sortable = $colIndex;
638
+	public function setSortable($colIndex=NULL) {
639
+		$this->_sortable=$colIndex;
640 640
 		return $this;
641 641
 	}
642 642
 
643
-	public function setActiveRowSelector($class = "active", $event = "click", $multiple = false) {
643
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
644 644
 		$this->_self->setActiveRowSelector($class, $event, $multiple);
645 645
 		return $this;
646 646
 	}
@@ -654,19 +654,19 @@  discard block
 block discarded – undo
654 654
 	}
655 655
 
656 656
 	public function hideColumn($colIndex) {
657
-		if (! \is_array($this->_hiddenColumns))
658
-			$this->_hiddenColumns = [];
659
-		$this->_hiddenColumns[] = $colIndex;
657
+		if (!\is_array($this->_hiddenColumns))
658
+			$this->_hiddenColumns=[];
659
+		$this->_hiddenColumns[]=$colIndex;
660 660
 		return $this;
661 661
 	}
662 662
 
663 663
 	public function setColWidth($colIndex, $width) {
664
-		$this->_colWidths[$colIndex] = $width;
664
+		$this->_colWidths[$colIndex]=$width;
665 665
 		return $this;
666 666
 	}
667 667
 
668 668
 	public function setColWidths($_colWidths) {
669
-		$this->_colWidths = $_colWidths;
669
+		$this->_colWidths=$_colWidths;
670 670
 		return $this;
671 671
 	}
672 672
 
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		return $this;
676 676
 	}
677 677
 
678
-	public function trigger($event, $params = "[]") {
678
+	public function trigger($event, $params="[]") {
679 679
 		return $this->getHtmlComponent()->trigger($event, $params);
680 680
 	}
681 681
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	 * @param mixed $_displayBehavior
714 714
 	 */
715 715
 	public function setDisplayBehavior($_displayBehavior) {
716
-		$this->_displayBehavior = $_displayBehavior;
716
+		$this->_displayBehavior=$_displayBehavior;
717 717
 	}
718 718
 
719 719
 	/**
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	}
734 734
 
735 735
 	public function addGroupBy($index) {
736
-		$index = $this->_getIndex($index);
737
-		if ($index !== false) {
736
+		$index=$this->_getIndex($index);
737
+		if ($index!==false) {
738 738
 			$this->_instanceViewer->addGroupBy($index);
739 739
 		}
740 740
 	}
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 * @param boolean $_visibleHover
745 745
 	 */
746 746
 	public function setVisibleHover($_visibleHover) {
747
-		$this->_visibleHover = $_visibleHover;
747
+		$this->_visibleHover=$_visibleHover;
748 748
 	}
749 749
 
750 750
 	/**
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 		return $this->_paginationToolbar;
756 756
 	}
757 757
 
758
-	public function setInverted($recursive = true) {
758
+	public function setInverted($recursive=true) {
759 759
 		$this->getHtmlComponent()->setInverted($recursive);
760 760
 		if ($this->_emptyMessage instanceof HtmlSemDoubleElement) {
761 761
 			$this->_emptyMessage->setInverted($recursive);
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 	}
768 768
 
769 769
 	public function setFormCaption($caption) {
770
-		$this->_caption = $caption;
770
+		$this->_caption=$caption;
771 771
 	}
772 772
 
773 773
 	/**
@@ -783,6 +783,6 @@  discard block
 block discarded – undo
783 783
 	 * @param mixed $namePrefix
784 784
 	 */
785 785
 	public function setNamePrefix($namePrefix): void {
786
-		$this->_namePrefix = $namePrefix;
786
+		$this->_namePrefix=$namePrefix;
787 787
 	}
788 788
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTableContent.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -15,15 +15,15 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class HtmlTableContent extends HtmlSemCollection {
17 17
 
18
-	protected $_focusable = false;
18
+	protected $_focusable=false;
19 19
 
20
-	protected $_tdTagNames = [
20
+	protected $_tdTagNames=[
21 21
 		"thead" => "th",
22 22
 		"tbody" => "td",
23 23
 		"tfoot" => "th"
24 24
 	];
25 25
 
26
-	protected $_merged = false;
26
+	protected $_merged=false;
27 27
 
28 28
 	/**
29 29
 	 *
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param int $rowCount
33 33
 	 * @param int $colCount
34 34
 	 */
35
-	public function __construct($identifier, $tagName = "tbody", $rowCount = NULL, $colCount = NULL) {
35
+	public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) {
36 36
 		parent::__construct($identifier, $tagName, "");
37 37
 		if (isset($rowCount) && isset($colCount))
38 38
 			$this->setRowCount($rowCount, $colCount);
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @return HtmlTableContent
46 46
 	 */
47 47
 	public function setRowCount($rowCount, $colCount) {
48
-		$count = $this->count();
49
-		for ($i = $count; $i < $rowCount; $i ++) {
48
+		$count=$this->count();
49
+		for ($i=$count; $i<$rowCount; $i++) {
50 50
 			$this->addItem($colCount);
51 51
 		}
52 52
 		return $this;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	}
58 58
 
59 59
 	public function refreshTR() {
60
-		$this->_template = "%wrapContentBefore%%content%%wrapContentAfter%";
60
+		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
61 61
 	}
62 62
 
63 63
 	/**
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 	 * @return HtmlTR
69 69
 	 */
70 70
 	protected function createItem($value) {
71
-		$count = $this->count();
72
-		$tr = new HtmlTR("");
71
+		$count=$this->count();
72
+		$tr=new HtmlTR("");
73 73
 		$tr->setContainer($this, $count);
74 74
 		if ($this->_focusable) {
75 75
 			$tr->setProperty('tabindex', $count);
76 76
 		}
77 77
 		$tr->setTdTagName($this->_tdTagNames[$this->tagName]);
78
-		if (isset($value) === true) {
78
+		if (isset($value)===true) {
79 79
 			$tr->setColCount($value);
80 80
 		}
81 81
 		return $tr;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		return $this->addItem($row);
104 104
 	}
105 105
 
106
-	public function addMergeRow($colCount, $value = null) {
107
-		$row = $this->addRow($colCount);
106
+	public function addMergeRow($colCount, $value=null) {
107
+		$row=$this->addRow($colCount);
108 108
 		$row->mergeCol();
109 109
 		if (isset($value)) {
110 110
 			$row->setValues([
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 	 * @return HtmlTD|HtmlDoubleElement
131 131
 	 */
132 132
 	public function getCell($row, $col) {
133
-		$row = $this->getItem($row);
133
+		$row=$this->getItem($row);
134 134
 		if (isset($row) && $row instanceof HtmlCollection) {
135
-			$col = $row->getItem($col);
135
+			$col=$row->getItem($col);
136 136
 		} else {
137
-			$col = $row;
137
+			$col=$row;
138 138
 		}
139 139
 		return $col;
140 140
 	}
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 	 * @param mixed $value
156 156
 	 * @return HtmlTableContent
157 157
 	 */
158
-	public function setCellValue($row, $col, $value = "") {
159
-		$cell = $this->getCell($row, $col);
160
-		if (isset($cell) === true) {
158
+	public function setCellValue($row, $col, $value="") {
159
+		$cell=$this->getCell($row, $col);
160
+		if (isset($cell)===true) {
161 161
 			$cell->setValue($value);
162 162
 		}
163 163
 		return $this;
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @param mixed $values
170 170
 	 */
171
-	public function setValues($values = array()) {
172
-		return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) {
171
+	public function setValues($values=array()) {
172
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {
173 173
 			$row->setValues($_values);
174 174
 		});
175 175
 	}
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @param mixed $values
181 181
 	 */
182
-	public function addValues($values = array()) {
183
-		return $this->_addOrSetValues($values, function (HtmlTR $row, $_values) {
182
+	public function addValues($values=array()) {
183
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {
184 184
 			$row->addValues($_values);
185 185
 		});
186 186
 	}
@@ -192,42 +192,42 @@  discard block
 block discarded – undo
192 192
 	 * @param callable $callback
193 193
 	 */
194 194
 	protected function _addOrSetValues($values, $callback) {
195
-		$count = $this->count();
196
-		$isArray = true;
197
-		if (! \is_array($values)) {
198
-			$values = \array_fill(0, $count, $values);
199
-			$isArray = false;
195
+		$count=$this->count();
196
+		$isArray=true;
197
+		if (!\is_array($values)) {
198
+			$values=\array_fill(0, $count, $values);
199
+			$isArray=false;
200 200
 		}
201
-		if (JArray::dimension($values) == 1 && $isArray)
202
-			$values = [
201
+		if (JArray::dimension($values)==1 && $isArray)
202
+			$values=[
203 203
 				$values
204 204
 			];
205 205
 
206
-		$count = \min(\sizeof($values), $count);
206
+		$count=\min(\sizeof($values), $count);
207 207
 
208
-		for ($i = 0; $i < $count; $i ++) {
209
-			$row = $this->content[$i];
208
+		for ($i=0; $i<$count; $i++) {
209
+			$row=$this->content[$i];
210 210
 			$callback($row, $values[$i]);
211 211
 		}
212 212
 		return $this;
213 213
 	}
214 214
 
215
-	public function setColValues($colIndex, $values = array()) {
216
-		$count = $this->count();
217
-		if (! \is_array($values)) {
218
-			$values = \array_fill(0, $count, $values);
215
+	public function setColValues($colIndex, $values=array()) {
216
+		$count=$this->count();
217
+		if (!\is_array($values)) {
218
+			$values=\array_fill(0, $count, $values);
219 219
 		}
220
-		$count = \min(\sizeof($values), $count);
221
-		for ($i = 0; $i < $count; $i ++) {
220
+		$count=\min(\sizeof($values), $count);
221
+		for ($i=0; $i<$count; $i++) {
222 222
 			$this->getCell($i, $colIndex)->setValue($values[$i]);
223 223
 		}
224 224
 		return $this;
225 225
 	}
226 226
 
227
-	public function addColVariations($colIndex, $variations = array()) {
228
-		$count = $this->count();
229
-		for ($i = 0; $i < $count; $i ++) {
230
-			$cell = $this->getCell($i, $colIndex);
227
+	public function addColVariations($colIndex, $variations=array()) {
228
+		$count=$this->count();
229
+		for ($i=0; $i<$count; $i++) {
230
+			$cell=$this->getCell($i, $colIndex);
231 231
 			if ($cell instanceof BaseTrait)
232 232
 				$cell->addVariations($variations);
233 233
 		}
@@ -235,31 +235,31 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 
237 237
 	public function addPropertyCol($colIndex, $name, $value) {
238
-		$count = $this->count();
239
-		for ($i = 0; $i < $count; $i ++) {
240
-			$cell = $this->getCell($i, $colIndex);
238
+		$count=$this->count();
239
+		for ($i=0; $i<$count; $i++) {
240
+			$cell=$this->getCell($i, $colIndex);
241 241
 			if (isset($cell))
242 242
 				$cell->addToProperty($name, $value);
243 243
 		}
244 244
 		return $this;
245 245
 	}
246 246
 
247
-	public function setRowValues($rowIndex, $values = array()) {
248
-		$count = $this->count();
249
-		if (! \is_array($values)) {
250
-			$values = \array_fill(0, $count, $values);
247
+	public function setRowValues($rowIndex, $values=array()) {
248
+		$count=$this->count();
249
+		if (!\is_array($values)) {
250
+			$values=\array_fill(0, $count, $values);
251 251
 		}
252 252
 		$this->getItem($rowIndex)->setValues($values);
253 253
 		return $this;
254 254
 	}
255 255
 
256 256
 	private function colAlign($colIndex, $function) {
257
-		$count = $this->count();
258
-		for ($i = 0; $i < $count; $i ++) {
259
-			$index = $this->content[$i]->getColPosition($colIndex);
260
-			if ($index !== NULL) {
261
-				$cell = $this->getCell($i, $index);
262
-				if ($cell != NULL) {
257
+		$count=$this->count();
258
+		for ($i=0; $i<$count; $i++) {
259
+			$index=$this->content[$i]->getColPosition($colIndex);
260
+			if ($index!==NULL) {
261
+				$cell=$this->getCell($i, $index);
262
+				if ($cell!=NULL) {
263 263
 					$cell->$function();
264 264
 				}
265 265
 			}
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	}
269 269
 
270 270
 	private function colAlignFromRight($colIndex, $function) {
271
-		$count = $this->count();
272
-		for ($i = 0; $i < $count; $i ++) {
273
-			$maxRow = $this->content[$i]->count();
274
-			$index = $maxRow - $colIndex - 1;
275
-			if (($cell = $this->getCell($i, $index)) !== NULL) {
276
-				if ($cell->getColspan() == 1)
271
+		$count=$this->count();
272
+		for ($i=0; $i<$count; $i++) {
273
+			$maxRow=$this->content[$i]->count();
274
+			$index=$maxRow-$colIndex-1;
275
+			if (($cell=$this->getCell($i, $index))!==NULL) {
276
+				if ($cell->getColspan()==1)
277 277
 					$cell->$function();
278 278
 			}
279 279
 		}
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	 * @return int
320 320
 	 */
321 321
 	public function getColCount() {
322
-		$result = 0;
323
-		if ($this->count() > 0)
324
-			$result = $this->getItem(0)->count();
322
+		$result=0;
323
+		if ($this->count()>0)
324
+			$result=$this->getItem(0)->count();
325 325
 		return $result;
326 326
 	}
327 327
 
@@ -332,10 +332,10 @@  discard block
 block discarded – undo
332 332
 	 * @param int $colIndex
333 333
 	 * @return HtmlTableContent
334 334
 	 */
335
-	public function delete($rowIndex, $colIndex = NULL) {
335
+	public function delete($rowIndex, $colIndex=NULL) {
336 336
 		if (isset($colIndex)) {
337
-			$row = $this->getItem($rowIndex);
338
-			if (isset($row) === true) {
337
+			$row=$this->getItem($rowIndex);
338
+			if (isset($row)===true) {
339 339
 				$row->delete($colIndex);
340 340
 			}
341 341
 		} else {
@@ -345,24 +345,24 @@  discard block
 block discarded – undo
345 345
 	}
346 346
 
347 347
 	public function toDelete($rowIndex, $colIndex) {
348
-		$row = $this->getItem($rowIndex);
349
-		if (isset($row) === true)
348
+		$row=$this->getItem($rowIndex);
349
+		if (isset($row)===true)
350 350
 			$row->toDelete($colIndex);
351 351
 		return $this;
352 352
 	}
353 353
 
354 354
 	public function toRowspanned($rowIndex, $colIndex) {
355
-		$row = $this->getItem($rowIndex);
356
-		if (isset($row) === true)
355
+		$row=$this->getItem($rowIndex);
356
+		if (isset($row)===true)
357 357
 			$row->toRowspanned($colIndex);
358 358
 		return $this;
359 359
 	}
360 360
 
361
-	public function mergeCol($rowIndex = 0, $colIndex = 0) {
361
+	public function mergeCol($rowIndex=0, $colIndex=0) {
362 362
 		return $this->getItem($rowIndex)->mergeCol($colIndex);
363 363
 	}
364 364
 
365
-	public function mergeRow($rowIndex = 0, $colIndex = 0) {
365
+	public function mergeRow($rowIndex=0, $colIndex=0) {
366 366
 		return $this->getItem($rowIndex)->mergeRow($colIndex);
367 367
 	}
368 368
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @return HtmlTableContent
383 383
 	 */
384 384
 	public function conditionalCellFormat($callback, $format) {
385
-		$rows = $this->content;
385
+		$rows=$this->content;
386 386
 		foreach ($rows as $row) {
387 387
 			$row->conditionalCellFormat($callback, $format);
388 388
 		}
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 	}
391 391
 
392 392
 	public function conditionalColFormat($colIndex, $callback, $format) {
393
-		$rows = $this->content;
393
+		$rows=$this->content;
394 394
 		foreach ($rows as $row) {
395
-			$cell = $row->getItem($colIndex);
395
+			$cell=$row->getItem($colIndex);
396 396
 			$cell->conditionnalCellFormat($callback, $format);
397 397
 		}
398 398
 		return $this;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @return HtmlTableContent
406 406
 	 */
407 407
 	public function conditionalRowFormat($callback, $format) {
408
-		$rows = $this->content;
408
+		$rows=$this->content;
409 409
 		foreach ($rows as $row) {
410 410
 			$row->conditionalRowFormat($callback, $format);
411 411
 		}
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 	}
414 414
 
415 415
 	public function hideColumn($colIndex) {
416
-		$rows = $this->content;
416
+		$rows=$this->content;
417 417
 		foreach ($rows as $row) {
418
-			$cell = $row->getItem($colIndex);
418
+			$cell=$row->getItem($colIndex);
419 419
 			$cell->addToProperty("style", "display:none;");
420 420
 		}
421 421
 		return $this;
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * @return HtmlTableContent
428 428
 	 */
429 429
 	public function applyCells($callback) {
430
-		$rows = $this->content;
430
+		$rows=$this->content;
431 431
 		foreach ($rows as $row) {
432 432
 			$row->applyCells($callback);
433 433
 		}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @return HtmlTableContent
441 441
 	 */
442 442
 	public function applyRows($callback) {
443
-		$rows = $this->content;
443
+		$rows=$this->content;
444 444
 		foreach ($rows as $row) {
445 445
 			$row->apply($callback);
446 446
 		}
@@ -455,28 +455,28 @@  discard block
 block discarded – undo
455 455
 	 * @see https://fomantic-ui.com/collections/table.html#definition needs rowspanned class
456 456
 	 * @since fomantic-ui 2.4.8
457 457
 	 */
458
-	public function mergeIdentiqualValues($colIndex, $function = "strip_tags") {
459
-		$rows = $this->content;
460
-		$identiqual = null;
461
-		$counter = 0;
462
-		$cellToMerge = null;
463
-		$functionExists = \function_exists($function);
458
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
459
+		$rows=$this->content;
460
+		$identiqual=null;
461
+		$counter=0;
462
+		$cellToMerge=null;
463
+		$functionExists=\function_exists($function);
464 464
 		foreach ($rows as $row) {
465
-			$cell = $row->getItem($colIndex);
466
-			$value = $cell->getContent();
465
+			$cell=$row->getItem($colIndex);
466
+			$value=$cell->getContent();
467 467
 			if ($functionExists)
468
-				$value = \call_user_func($function, $value);
469
-			if ($value !== $identiqual) {
470
-				if ($counter > 0 && isset($cellToMerge)) {
468
+				$value=\call_user_func($function, $value);
469
+			if ($value!==$identiqual) {
470
+				if ($counter>0 && isset($cellToMerge)) {
471 471
 					$cellToMerge->setRowspanned($counter);
472 472
 				}
473
-				$counter = 0;
474
-				$cellToMerge = $cell;
475
-				$identiqual = $value;
473
+				$counter=0;
474
+				$cellToMerge=$cell;
475
+				$identiqual=$value;
476 476
 			}
477
-			$counter ++;
477
+			$counter++;
478 478
 		}
479
-		if ($counter > 0 && isset($cellToMerge)) {
479
+		if ($counter>0 && isset($cellToMerge)) {
480 480
 			$cellToMerge->setRowspanned($counter);
481 481
 		}
482 482
 		return $this;
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 	}
488 488
 
489 489
 	public function _setMerged($value) {
490
-		$this->_merged = $value;
490
+		$this->_merged=$value;
491 491
 		return $this;
492 492
 	}
493 493
 
@@ -496,6 +496,6 @@  discard block
 block discarded – undo
496 496
 	 * @param bool $focusable
497 497
 	 */
498 498
 	public function setFocusable(bool $focusable): void {
499
-		$this->_focusable = $focusable;
499
+		$this->_focusable=$focusable;
500 500
 	}
501 501
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
  */
38 38
 trait FieldAsTrait {
39 39
 
40
-	abstract protected function _getFieldIdentifier($prefix, $name = "");
40
+	abstract protected function _getFieldIdentifier($prefix, $name="");
41 41
 
42 42
 	abstract public function setValueFunction($index, $callback);
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 	abstract protected function _getFieldCaption($index);
47 47
 
48
-	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement = NULL, $parameters = NULL);
48
+	abstract protected function _buttonAsSubmit(BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL);
49 49
 
50 50
 	private $_speProperties;
51 51
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param HtmlFormField $element
55 55
 	 * @param array $attributes
56 56
 	 */
57
-	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance = null) {
57
+	protected function _applyAttributes(BaseHtml $element, &$attributes, $index, $instance=null) {
58 58
 		if (isset($attributes["jsCallback"])) {
59
-			$callback = $attributes["jsCallback"];
59
+			$callback=$attributes["jsCallback"];
60 60
 			if (\is_callable($callback)) {
61 61
 				$callback($element, $instance, $index, InstanceViewer::$index);
62 62
 			}
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 		$element->fromArray($attributes);
68 68
 	}
69 69
 
70
-	private function _getLabelField($caption, $icon = NULL) {
71
-		$label = new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
70
+	private function _getLabelField($caption, $icon=NULL) {
71
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
72 72
 		return $label;
73 73
 	}
74 74
 
75 75
 	protected function _addRules(HtmlFormField $element, &$attributes) {
76 76
 		if (isset($attributes["rules"])) {
77
-			$this->_hasRules = true;
78
-			$rules = $attributes["rules"];
77
+			$this->_hasRules=true;
78
+			$rules=$attributes["rules"];
79 79
 			if (\is_array($rules)) {
80 80
 				$element->addRules($rules);
81 81
 			} else {
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
 		return $field;
92 92
 	}
93 93
 
94
-	protected function _fieldAs($elementCallback, &$index, $attributes = NULL, $prefix = null) {
95
-		$this->setValueFunction($index, function ($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) {
96
-			$caption = $this->_getFieldCaption($index);
97
-			$name = $this->_getFieldName($index);
98
-			$id = $this->_getFieldIdentifier($prefix, $name);
94
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
95
+		$this->setValueFunction($index, function($value, $instance, $index, $rowIndex) use (&$attributes, $elementCallback, $prefix) {
96
+			$caption=$this->_getFieldCaption($index);
97
+			$name=$this->_getFieldName($index);
98
+			$id=$this->_getFieldIdentifier($prefix, $name);
99 99
 			if (isset($attributes["name"])) {
100
-				$name = $attributes["name"];
100
+				$name=$attributes["name"];
101 101
 				unset($attributes["name"]);
102 102
 			}
103
-			$element = $elementCallback($id, $name, $value, $caption);
103
+			$element=$elementCallback($id, $name, $value, $caption);
104 104
 			if (isset($this->_speProperties[$index])) {
105 105
 				$attributes ??= [];
106
-				$attributes += $this->_speProperties[$index];
106
+				$attributes+=$this->_speProperties[$index];
107 107
 			}
108 108
 			if (\is_array($attributes)) {
109 109
 				$this->_applyAttributes($element, $attributes, $index, $instance);
110 110
 			}
111
-			$element->setDisabled(! $this->_edition);
111
+			$element->setDisabled(!$this->_edition);
112 112
 			return $element;
113 113
 		});
114 114
 		return $this;
@@ -124,48 +124,48 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function setPropertyValues($property, $indexValues) {
126 126
 		foreach ($indexValues as $index => $value) {
127
-			$ind = $this->_getIndex($index);
128
-			$this->_speProperties[$ind][$property] = $value;
127
+			$ind=$this->_getIndex($index);
128
+			$this->_speProperties[$ind][$property]=$value;
129 129
 		}
130 130
 	}
131 131
 
132
-	public function fieldAsProgress($index, $label = NULL, $attributes = array()) {
133
-		$this->setValueFunction($index, function ($value) use ($label, $attributes) {
134
-			$pb = new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
132
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
133
+		$this->setValueFunction($index, function($value) use ($label, $attributes) {
134
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
135 135
 			return $pb;
136 136
 		});
137 137
 		return $this;
138 138
 	}
139 139
 
140
-	public function fieldAsRating($index, $max = 5, $icon = "") {
141
-		$this->setValueFunction($index, function ($value) use ($max, $icon) {
142
-			$rating = new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
140
+	public function fieldAsRating($index, $max=5, $icon="") {
141
+		$this->setValueFunction($index, function($value) use ($max, $icon) {
142
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
143 143
 			return $rating;
144 144
 		});
145 145
 		return $this;
146 146
 	}
147 147
 
148
-	public function fieldAsLabel($index, $icon = NULL, $attributes = NULL) {
149
-		return $this->_fieldAs(function ($id, $name, $value) use ($icon) {
150
-			$lbl = new HtmlLabel($id, $value);
148
+	public function fieldAsLabel($index, $icon=NULL, $attributes=NULL) {
149
+		return $this->_fieldAs(function($id, $name, $value) use ($icon) {
150
+			$lbl=new HtmlLabel($id, $value);
151 151
 			if (isset($icon))
152 152
 				$lbl->addIcon($icon);
153 153
 			return $lbl;
154 154
 		}, $index, $attributes, "label");
155 155
 	}
156 156
 
157
-	public function fieldAsHeader($index, $niveau = 1, $icon = NULL, $attributes = NULL) {
158
-		return $this->_fieldAs(function ($id, $name, $value) use ($niveau, $icon) {
159
-			$header = new HtmlHeader($id, $niveau, $value);
157
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
158
+		return $this->_fieldAs(function($id, $name, $value) use ($niveau, $icon) {
159
+			$header=new HtmlHeader($id, $niveau, $value);
160 160
 			if (isset($icon))
161 161
 				$header->asIcon($icon, $value);
162 162
 			return $header;
163 163
 		}, $index, $attributes, "header");
164 164
 	}
165 165
 
166
-	public function fieldAsImage($index, $size = Size::MINI, $circular = false) {
167
-		$this->setValueFunction($index, function ($img) use ($size, $circular) {
168
-			$image = new HtmlImage($this->_getFieldIdentifier("image"), $img);
166
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
167
+		$this->setValueFunction($index, function($img) use ($size, $circular) {
168
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img);
169 169
 			$image->setSize($size);
170 170
 			if ($circular)
171 171
 				$image->setCircular();
@@ -175,65 +175,65 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	public function fieldAsFlag($index) {
178
-		$this->setValueFunction($index, function ($flag) {
179
-			$flag = new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
178
+		$this->setValueFunction($index, function($flag) {
179
+			$flag=new HtmlFlag($this->_getFieldIdentifier("flag"), $flag);
180 180
 			return $flag;
181 181
 		});
182 182
 		return $this;
183 183
 	}
184 184
 
185 185
 	public function fieldAsIcon($index) {
186
-		$this->setValueFunction($index, function ($icon) {
187
-			$icon = new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
186
+		$this->setValueFunction($index, function($icon) {
187
+			$icon=new HtmlIcon($this->_getFieldIdentifier("icon"), $icon);
188 188
 			return $icon;
189 189
 		});
190 190
 		return $this;
191 191
 	}
192 192
 
193
-	public function fieldAsAvatar($index, $attributes = NULL) {
194
-		return $this->_fieldAs(function ($id, $name, $value) {
195
-			$img = new HtmlImage($id, $value);
193
+	public function fieldAsAvatar($index, $attributes=NULL) {
194
+		return $this->_fieldAs(function($id, $name, $value) {
195
+			$img=new HtmlImage($id, $value);
196 196
 			$img->asAvatar();
197 197
 			return $img;
198 198
 		}, $index, $attributes, "avatar");
199 199
 	}
200 200
 
201
-	public function fieldAsRadio($index, $attributes = NULL) {
202
-		return $this->_fieldAs(function ($id, $name, $value) use ($attributes) {
203
-			$input = new HtmlFormRadio($id, $name, $value, $value);
201
+	public function fieldAsRadio($index, $attributes=NULL) {
202
+		return $this->_fieldAs(function($id, $name, $value) use ($attributes) {
203
+			$input=new HtmlFormRadio($id, $name, $value, $value);
204 204
 			return $this->_prepareFormFields($input, $name, $attributes);
205 205
 		}, $index, $attributes, "radio");
206 206
 	}
207 207
 
208
-	public function fieldAsRadios($index, $elements = [], $attributes = NULL) {
209
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements) {
208
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
209
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements) {
210 210
 			return HtmlFormFields::radios($name, $elements, $caption, $value);
211 211
 		}, $index, $attributes, "radios");
212 212
 	}
213 213
 
214
-	public function fieldAsList($index, $classNames = "", $attributes = NULL) {
215
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($classNames) {
216
-			$result = new HtmlList($name, $value);
214
+	public function fieldAsList($index, $classNames="", $attributes=NULL) {
215
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($classNames) {
216
+			$result=new HtmlList($name, $value);
217 217
 			$result->addClass($classNames);
218 218
 			return $result;
219 219
 		}, $index, $attributes, "list");
220 220
 	}
221 221
 
222
-	public function fieldAsInput($index, $attributes = NULL) {
223
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
224
-			$input = new HtmlFormInput($id, $caption, "text", $value);
222
+	public function fieldAsInput($index, $attributes=NULL) {
223
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
224
+			$input=new HtmlFormInput($id, $caption, "text", $value);
225 225
 			return $this->_prepareFormFields($input, $name, $attributes);
226 226
 		}, $index, $attributes, "input");
227 227
 	}
228 228
 
229
-	public function fieldAsLabeledInput($index, $attributes = NULL) {
230
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
231
-			$input = new HtmlFormInput($id, '', 'text', $value, $caption);
232
-			$required = '';
229
+	public function fieldAsLabeledInput($index, $attributes=NULL) {
230
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
231
+			$input=new HtmlFormInput($id, '', 'text', $value, $caption);
232
+			$required='';
233 233
 			if (isset($attributes['rules'])) {
234
-				$rules = json_encode($attributes['rules']);
235
-				if (strpos($rules, 'empty') !== false) {
236
-					$required = 'required';
234
+				$rules=json_encode($attributes['rules']);
235
+				if (strpos($rules, 'empty')!==false) {
236
+					$required='required';
237 237
 				}
238 238
 			}
239 239
 			$input->getField()
@@ -244,80 +244,80 @@  discard block
 block discarded – undo
244 244
 		}, $index, $attributes, 'input');
245 245
 	}
246 246
 
247
-	public function fieldAsDataList($index, ?array $items = [], $attributes = NULL) {
248
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $items) {
249
-			$input = new HtmlFormInput($id, $caption, "text", $value);
247
+	public function fieldAsDataList($index, ?array $items=[], $attributes=NULL) {
248
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $items) {
249
+			$input=new HtmlFormInput($id, $caption, "text", $value);
250 250
 			$input->getField()
251 251
 				->addDataList($items);
252 252
 			return $this->_prepareFormFields($input, $name, $attributes);
253 253
 		}, $index, $attributes, "input");
254 254
 	}
255 255
 
256
-	public function fieldAsFile($index, $attributes = NULL) {
256
+	public function fieldAsFile($index, $attributes=NULL) {
257 257
 		if (isset($this->_form)) {
258 258
 			$this->_form->setProperty('enctype', 'multipart/form-data');
259 259
 		}
260
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
261
-			$input = new HtmlFormInput($id, $caption);
260
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
261
+			$input=new HtmlFormInput($id, $caption);
262 262
 			$input->asFile();
263 263
 			return $this->_prepareFormFields($input, $name, $attributes);
264 264
 		}, $index, $attributes, "input");
265 265
 	}
266 266
 
267
-	public function fieldAsTextarea($index, $attributes = NULL) {
268
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
269
-			$textarea = new HtmlFormTextarea($id, $caption, $value);
267
+	public function fieldAsTextarea($index, $attributes=NULL) {
268
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
269
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
270 270
 			return $this->_prepareFormFields($textarea, $name, $attributes);
271 271
 		}, $index, $attributes, "textarea");
272 272
 	}
273 273
 
274
-	public function fieldAsElement($index, $tagName = "div", $baseClass = "", $attributes = NULL) {
275
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) {
276
-			$div = new HtmlSemDoubleElement($id, $tagName, $baseClass);
274
+	public function fieldAsElement($index, $tagName="div", $baseClass="", $attributes=NULL) {
275
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes, $tagName, $baseClass) {
276
+			$div=new HtmlSemDoubleElement($id, $tagName, $baseClass);
277 277
 			$div->setContent(\htmlentities($value));
278
-			$textarea = new HtmlFormField("field-" . $id, $div, $caption);
278
+			$textarea=new HtmlFormField("field-".$id, $div, $caption);
279 279
 			return $this->_prepareFormFields($textarea, $name, $attributes);
280 280
 		}, $index, $attributes, "element");
281 281
 	}
282 282
 
283
-	public function fieldAsHidden($index, $attributes = NULL) {
284
-		if (! \is_array($attributes)) {
285
-			$attributes = [];
283
+	public function fieldAsHidden($index, $attributes=NULL) {
284
+		if (!\is_array($attributes)) {
285
+			$attributes=[];
286 286
 		}
287
-		$attributes["inputType"] = "hidden";
288
-		$attributes["style"] = "display:none;";
287
+		$attributes["inputType"]="hidden";
288
+		$attributes["style"]="display:none;";
289 289
 		return $this->fieldAsInput($index, $attributes);
290 290
 	}
291 291
 
292
-	public function fieldAsCheckbox($index, $attributes = NULL) {
293
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($attributes) {
294
-			if ($caption === null || $caption === "")
295
-				$caption = "";
296
-			$input = new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
292
+	public function fieldAsCheckbox($index, $attributes=NULL) {
293
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes) {
294
+			if ($caption===null || $caption==="")
295
+				$caption="";
296
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
297 297
 			$input->setChecked(JString::isBooleanTrue($value));
298 298
 			return $this->_prepareFormFields($input, $name, $attributes);
299 299
 		}, $index, $attributes, "ck");
300 300
 	}
301 301
 
302
-	public function fieldAsDropDown($index, $elements = [], $multiple = false, $attributes = NULL) {
303
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($elements, $multiple, $attributes) {
304
-			$dd = new HtmlFormDropdown($id, $elements, $caption, $value ?? '');
302
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
303
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements, $multiple, $attributes) {
304
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value ?? '');
305 305
 			$dd->asSelect($name, $multiple);
306 306
 			return $this->_prepareFormFields($dd, $name, $attributes);
307 307
 		}, $index, $attributes, "dd");
308 308
 	}
309 309
 
310
-	public function fieldAsMessage($index, $attributes = NULL) {
311
-		return $this->_fieldAs(function ($id, $name, $value, $caption) {
312
-			$mess = new HtmlMessage("message-" . $id, $caption);
310
+	public function fieldAsMessage($index, $attributes=NULL) {
311
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
312
+			$mess=new HtmlMessage("message-".$id, $caption);
313 313
 			$mess->addHeader($value);
314 314
 			return $mess;
315 315
 		}, $index, $attributes, "message");
316 316
 	}
317 317
 
318
-	public function fieldAsLink($index, $attributes = NULL) {
319
-		return $this->_fieldAs(function ($id, $name, $value, $caption) {
320
-			$lnk = new HtmlLink("message-" . $id, "#", $caption);
318
+	public function fieldAsLink($index, $attributes=NULL) {
319
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
320
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
321 321
 			return $lnk;
322 322
 		}, $index, $attributes, "link");
323 323
 	}
@@ -329,28 +329,28 @@  discard block
 block discarded – undo
329 329
 	 *        	an array or associative array $type=>$attributes
330 330
 	 */
331 331
 	public function fieldsAs(array $types) {
332
-		$i = 0;
332
+		$i=0;
333 333
 		if (JArray::isAssociative($types)) {
334 334
 			foreach ($types as $type => $attributes) {
335 335
 				if (\is_int($type))
336
-					$this->fieldAs($i ++, $attributes, []);
336
+					$this->fieldAs($i++, $attributes, []);
337 337
 				else {
338
-					$type = preg_replace('/\d/', '', $type);
339
-					$this->fieldAs($i ++, $type, $attributes);
338
+					$type=preg_replace('/\d/', '', $type);
339
+					$this->fieldAs($i++, $type, $attributes);
340 340
 				}
341 341
 			}
342 342
 		} else {
343 343
 			foreach ($types as $type) {
344
-				$this->fieldAs($i ++, $type);
344
+				$this->fieldAs($i++, $type);
345 345
 			}
346 346
 		}
347 347
 	}
348 348
 
349
-	public function fieldAs($index, $type, $attributes = NULL) {
350
-		$method = "fieldAs" . \ucfirst($type);
349
+	public function fieldAs($index, $type, $attributes=NULL) {
350
+		$method="fieldAs".\ucfirst($type);
351 351
 		if (\method_exists($this, $method)) {
352
-			if (! \is_array($attributes)) {
353
-				$attributes = [
352
+			if (!\is_array($attributes)) {
353
+				$attributes=[
354 354
 					$index
355 355
 				];
356 356
 			} else {
@@ -363,39 +363,39 @@  discard block
 block discarded – undo
363 363
 		}
364 364
 	}
365 365
 
366
-	public function fieldAsSubmit($index, $cssStyle = NULL, $url = NULL, $responseElement = NULL, $attributes = NULL) {
367
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) {
368
-			$button = new HtmlButton($id, $caption, $cssStyle);
366
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
367
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes) {
368
+			$button=new HtmlButton($id, $caption, $cssStyle);
369 369
 			$this->_buttonAsSubmit($button, "click", $url, $responseElement, $attributes["ajax"] ?? []);
370 370
 			return $button;
371 371
 		}, $index, $attributes, "submit");
372 372
 	}
373 373
 
374
-	public function fieldAsButton($index, $cssStyle = NULL, $attributes = NULL) {
375
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($cssStyle) {
376
-			$button = new HtmlButton($id, $value, $cssStyle);
374
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
375
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle) {
376
+			$button=new HtmlButton($id, $value, $cssStyle);
377 377
 			return $button;
378 378
 		}, $index, $attributes, "button");
379 379
 	}
380 380
 
381
-	public function fieldAsDataTable($index, $model, $instances = null, $fields = [], $attributes = NULL) {
382
-		return $this->_fieldAs(function ($id, $name, $value, $caption) use ($model, $instances, $fields, $index) {
383
-			$dt = new DataTable($id, $model, $instances);
381
+	public function fieldAsDataTable($index, $model, $instances=null, $fields=[], $attributes=NULL) {
382
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($model, $instances, $fields, $index) {
383
+			$dt=new DataTable($id, $model, $instances);
384 384
 			$dt->setNamePrefix($index);
385 385
 			$dt->setFields($fields);
386 386
 			$dt->setEdition(true);
387
-			$dt->addDeleteButton(false, [], function ($bt) use ($index) {
387
+			$dt->addDeleteButton(false, [], function($bt) use ($index) {
388 388
 				$bt->addClass('mini circular')
389
-					->wrap('<input value="" class="_status" type="hidden" name="' . $index . '._status[]">');
389
+					->wrap('<input value="" class="_status" type="hidden" name="'.$index.'._status[]">');
390 390
 			});
391
-			if ($caption != null) {
391
+			if ($caption!=null) {
392 392
 				$dt->setFormCaption($caption);
393 393
 			}
394
-			$dt->onPreCompile(function () use (&$dt) {
394
+			$dt->onPreCompile(function() use (&$dt) {
395 395
 				$dt->getHtmlComponent()
396 396
 					->colRightFromRight(0);
397 397
 			});
398
-			$dt->wrap('<input type="hidden" name="' . $index . '">');
398
+			$dt->wrap('<input type="hidden" name="'.$index.'">');
399 399
 			return $dt;
400 400
 		}, $index, $attributes, "dataTable");
401 401
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormInput.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@  discard block
 block discarded – undo
7 7
 class HtmlFormInput extends HtmlFormField {
8 8
 	use TextFieldsTrait;
9 9
 
10
-	const TOGGLE_CLICK = 0;
10
+	const TOGGLE_CLICK=0;
11 11
 
12
-	const TOGGLE_MOUSEDOWN = 1;
12
+	const TOGGLE_MOUSEDOWN=1;
13 13
 
14
-	const TOGGLE_INTERVAL = 2;
14
+	const TOGGLE_INTERVAL=2;
15 15
 
16
-	public function __construct($identifier, $label = NULL, $type = "text", $value = NULL, $placeholder = NULL) {
17
-		if (! isset($placeholder) && $type === "text")
18
-			$placeholder = $label;
19
-		parent::__construct("field-" . $identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
20
-		$this->_identifier = $identifier;
16
+	public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
17
+		if (!isset($placeholder) && $type==="text")
18
+			$placeholder=$label;
19
+		parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
20
+		$this->_identifier=$identifier;
21 21
 	}
22 22
 
23 23
 	public function getDataField() {
24
-		$field = $this->getField();
24
+		$field=$this->getField();
25 25
 		if ($field instanceof HtmlInput)
26
-			$field = $field->getDataField();
26
+			$field=$field->getDataField();
27 27
 		return $field;
28 28
 	}
29 29
 
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $keyIcon
34 34
 	 */
35
-	public function asPassword($keyIcon = 'key') {
35
+	public function asPassword($keyIcon='key') {
36 36
 		$this->setInputType('password');
37
-		if ($keyIcon != '') {
37
+		if ($keyIcon!='') {
38 38
 			$this->addIcon($keyIcon);
39 39
 		}
40 40
 	}
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 	 *        	one of TOGGLE_CLICK, TOGGLE_MOUSEDOWN, TOGGLE_INTERVAL
50 50
 	 * @return mixed|\Ajax\semantic\html\elements\HtmlButton
51 51
 	 */
52
-	public function addTogglePasswordAction($buttonIcon = 'eye', $keyIcon = 'key', $slashIcon = 'slash', $type = 0) {
52
+	public function addTogglePasswordAction($buttonIcon='eye', $keyIcon='key', $slashIcon='slash', $type=0) {
53 53
 		$this->asPassword($keyIcon);
54
-		$action = $this->addAction('see');
54
+		$action=$this->addAction('see');
55 55
 		$action->asIcon($buttonIcon);
56 56
 		switch ($type) {
57 57
 			case self::TOGGLE_CLICK:
58
-				$action->onClick('let th=$(this);' . $this->getJsToggle($slashIcon, '(_,attr)=>(attr=="text")?"password":"text"', 'toggle'));
58
+				$action->onClick('let th=$(this);'.$this->getJsToggle($slashIcon, '(_,attr)=>(attr=="text")?"password":"text"', 'toggle'));
59 59
 				break;
60 60
 			case self::TOGGLE_MOUSEDOWN:
61 61
 				$action->onClick('');
62
-				$action->addEvent('mousedown', 'let th=$(this);' . $this->getJsToggle($slashIcon, '"text"', 'add'));
63
-				$action->addEvent('mouseup', 'let th=$(this);' . $this->getJsToggle($slashIcon, '"password"', 'remove'));
64
-				$action->addEvent('mouseout', 'let th=$(this);' . $this->getJsToggle($slashIcon, '"password"', 'remove'));
62
+				$action->addEvent('mousedown', 'let th=$(this);'.$this->getJsToggle($slashIcon, '"text"', 'add'));
63
+				$action->addEvent('mouseup', 'let th=$(this);'.$this->getJsToggle($slashIcon, '"password"', 'remove'));
64
+				$action->addEvent('mouseout', 'let th=$(this);'.$this->getJsToggle($slashIcon, '"password"', 'remove'));
65 65
 				break;
66 66
 			case self::TOGGLE_INTERVAL:
67
-				$action->onClick('let th=$(this);' . $this->getJsToggle($slashIcon, '"text"', 'add') . 'setTimeout(function(){ ' . $this->getJsToggle($slashIcon, '"password"', 'remove') . ' }, 5000);');
67
+				$action->onClick('let th=$(this);'.$this->getJsToggle($slashIcon, '"text"', 'add').'setTimeout(function(){ '.$this->getJsToggle($slashIcon, '"password"', 'remove').' }, 5000);');
68 68
 				break;
69 69
 		}
70 70
 		return $action;
71 71
 	}
72 72
 
73 73
 	private function getJsToggle($slashIcon, $type, $actionClass) {
74
-		return 'th.find(".icon").' . $actionClass . 'Class("' . $slashIcon . '");th.closest(".field").find("input").attr("type",' . $type . ');';
74
+		return 'th.find(".icon").'.$actionClass.'Class("'.$slashIcon.'");th.closest(".field").find("input").attr("type",'.$type.');';
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsInternalTrait.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@  discard block
 block discarded – undo
5 5
 
6 6
 trait JsUtilsInternalTrait {
7 7
 
8
-	protected $jquery_code_for_compile = array();
8
+	protected $jquery_code_for_compile=array();
9 9
 
10
-	protected $jquery_code_for_compile_at_last = array();
10
+	protected $jquery_code_for_compile_at_last=array();
11 11
 
12 12
 	protected function _addToCompile($jsScript) {
13
-		$this->jquery_code_for_compile[] = $jsScript;
13
+		$this->jquery_code_for_compile[]=$jsScript;
14 14
 	}
15 15
 
16 16
 	/**
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param BaseGui $library
19 19
 	 * @param mixed $view
20 20
 	 */
21
-	protected function _compileLibrary(BaseGui $library, &$view = NULL) {
21
+	protected function _compileLibrary(BaseGui $library, &$view=NULL) {
22 22
 		if (isset($view))
23 23
 			$library->compileHtml($this, $view);
24 24
 		if ($library->isAutoCompile()) {
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 	}
28 28
 
29 29
 	protected function defer($script) {
30
-		$result = "window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};";
31
-		$result .= "window.defer(function(){" . $script . "})";
30
+		$result="window.defer=function (method) {if (window.jQuery) method(); else setTimeout(function() { defer(method) }, 50);};";
31
+		$result.="window.defer(function(){".$script."})";
32 32
 		return $result;
33 33
 	}
34 34
 
35 35
 	protected function ready($script) {
36
-		$result = '$(document).ready(function() {' . "\n";
37
-		$result .= $script . '})';
36
+		$result='$(document).ready(function() {'."\n";
37
+		$result.=$script.'})';
38 38
 		return $result;
39 39
 	}
40 40
 
41 41
 	protected function minify($input) {
42
-		if (trim($input) === "")
42
+		if (trim($input)==="")
43 43
 			return $input;
44
-		$input = preg_replace(array(
44
+		$input=preg_replace(array(
45 45
 			// Remove comment(s)
46 46
 			'#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@cc_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#',
47 47
 			// Remove white-space(s) outside the string and regex
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			'$1$3',
60 60
 			'$1.$3'
61 61
 		), $input);
62
-		$input = str_replace("}$", "};$", $input);
62
+		$input=str_replace("}$", "};$", $input);
63 63
 		return $input;
64 64
 	}
65 65
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * @param string $src
70 70
 	 * @return string
71 71
 	 */
72
-	protected function _open_script($src = '') {
73
-		$str = '<script ';
74
-		$str .= ($src == '') ? '>' : ' src="' . $src . '">';
72
+	protected function _open_script($src='') {
73
+		$str='<script ';
74
+		$str.=($src=='') ? '>' : ' src="'.$src.'">';
75 75
 		return $str;
76 76
 	}
77 77
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param string $extra
82 82
 	 * @return string
83 83
 	 */
84
-	protected function _close_script($extra = "\n") {
84
+	protected function _close_script($extra="\n") {
85 85
 		return "</script>$extra";
86 86
 	}
87 87
 
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
  * @version 1.3.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 
20 20
 	protected $_template;
21 21
 
22 22
 	protected $tagName;
23 23
 
24
-	protected $_wrapBefore = array();
24
+	protected $_wrapBefore=array();
25 25
 
26
-	protected $_wrapAfter = array();
26
+	protected $_wrapAfter=array();
27 27
 
28 28
 	protected $_bsComponent;
29 29
 
30
-	protected $_compiled = false;
30
+	protected $_compiled=false;
31 31
 
32
-	protected $_runned = false;
32
+	protected $_runned=false;
33 33
 
34 34
 	protected $_postCompile;
35 35
 
@@ -43,31 +43,31 @@  discard block
 block discarded – undo
43 43
 	abstract public function run(JsUtils $js);
44 44
 
45 45
 	private function _callSetter($setter, $key, $value, &$array) {
46
-		$result = false;
47
-		if (method_exists($this, $setter) && substr($setter, 0, 1) !== "_") {
46
+		$result=false;
47
+		if (method_exists($this, $setter) && substr($setter, 0, 1)!=="_") {
48 48
 			try {
49 49
 				$this->$setter($value);
50 50
 				unset($array[$key]);
51
-				$result = true;
52
-			} catch (\Exception $e) {
53
-				$result = false;
51
+				$result=true;
52
+			}catch (\Exception $e) {
53
+				$result=false;
54 54
 			}
55 55
 		}
56 56
 		return $result;
57 57
 	}
58 58
 
59
-	protected function getTemplate(JsUtils $js = NULL, $view = null) {
60
-		return PropertyWrapper::wrap($this->_wrapBefore, $js, $view) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js, $view);
59
+	protected function getTemplate(JsUtils $js=NULL, $view=null) {
60
+		return PropertyWrapper::wrap($this->_wrapBefore, $js, $view).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js, $view);
61 61
 	}
62 62
 
63 63
 	protected function ctrl($name, $value, $typeCtrl) {
64 64
 		if (\is_array($typeCtrl)) {
65
-			if (array_search($value, $typeCtrl) === false) {
66
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
65
+			if (array_search($value, $typeCtrl)===false) {
66
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
67 67
 			}
68 68
 		} else {
69
-			if (! $typeCtrl($value)) {
70
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
69
+			if (!$typeCtrl($value)) {
70
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
71 71
 			}
72 72
 		}
73 73
 		return true;
@@ -75,49 +75,49 @@  discard block
 block discarded – undo
75 75
 
76 76
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
77 77
 		$this->ctrl($name, $value, $typeCtrl);
78
-		$name = $value;
78
+		$name=$value;
79 79
 		return $this;
80 80
 	}
81 81
 
82
-	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator = " ") {
82
+	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
83 83
 		if (\is_array($typeCtrl)) {
84 84
 			$this->removeOldValues($name, $typeCtrl);
85
-			$name .= $separator . $value;
85
+			$name.=$separator.$value;
86 86
 		}
87 87
 		return $this;
88 88
 	}
89 89
 
90
-	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator = " ") {
90
+	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
91 91
 		$this->ctrl($name, $value, $typeCtrl);
92 92
 		if (\is_array($typeCtrl)) {
93 93
 			$this->removeOldValues($name, $typeCtrl);
94 94
 		}
95
-		$name .= $separator . $value;
95
+		$name.=$separator.$value;
96 96
 		return $this;
97 97
 	}
98 98
 
99
-	protected function addToMember(&$name, $value, $separator = " ") {
100
-		$name = str_ireplace($value, "", $name) . $separator . $value;
99
+	protected function addToMember(&$name, $value, $separator=" ") {
100
+		$name=str_ireplace($value, "", $name).$separator.$value;
101 101
 		return $this;
102 102
 	}
103 103
 
104 104
 	protected function removeOldValues(&$oldValue, $allValues) {
105
-		$oldValue = str_ireplace($allValues, "", $oldValue);
106
-		$oldValue = trim($oldValue);
105
+		$oldValue=str_ireplace($allValues, "", $oldValue);
106
+		$oldValue=trim($oldValue);
107 107
 	}
108 108
 
109 109
 	protected function _getElementBy($callback, $elements) {
110 110
 		if (\is_array($elements)) {
111
-			$elements = \array_values($elements);
112
-			$flag = false;
113
-			$index = 0;
114
-			while (! $flag && $index < sizeof($elements)) {
111
+			$elements=\array_values($elements);
112
+			$flag=false;
113
+			$index=0;
114
+			while (!$flag && $index<sizeof($elements)) {
115 115
 				if ($elements[$index] instanceof BaseHtml)
116
-					$flag = ($callback($elements[$index]));
117
-				$index ++;
116
+					$flag=($callback($elements[$index]));
117
+				$index++;
118 118
 			}
119
-			if ($flag === true)
120
-				return $elements[$index - 1];
119
+			if ($flag===true)
120
+				return $elements[$index-1];
121 121
 		} elseif ($elements instanceof BaseHtml) {
122 122
 			if ($callback($elements))
123 123
 				return $elements;
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 	}
127 127
 
128 128
 	protected function setWrapBefore($wrapBefore) {
129
-		$this->_wrapBefore = $wrapBefore;
129
+		$this->_wrapBefore=$wrapBefore;
130 130
 		return $this;
131 131
 	}
132 132
 
133 133
 	protected function setWrapAfter($wrapAfter) {
134
-		$this->_wrapAfter = $wrapAfter;
134
+		$this->_wrapAfter=$wrapAfter;
135 135
 		return $this;
136 136
 	}
137 137
 
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
 	}
141 141
 
142 142
 	public function setTagName($tagName) {
143
-		$this->tagName = $tagName;
143
+		$this->tagName=$tagName;
144 144
 		return $this;
145 145
 	}
146 146
 
147 147
 	public function fromArray($array) {
148 148
 		foreach ($this as $key => $value) {
149
-			if (array_key_exists($key, $array) === true)
150
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
149
+			if (array_key_exists($key, $array)===true)
150
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
151 151
 		}
152 152
 		foreach ($array as $key => $value) {
153
-			if ($this->_callSetter($key, $key, $value, $array) === false) {
154
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
153
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
154
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
155 155
 			}
156 156
 		}
157 157
 		return $array;
@@ -168,17 +168,17 @@  discard block
 block discarded – undo
168 168
 
169 169
 	public function fromDatabaseObject($object, $function) {}
170 170
 
171
-	public function wrap($before, $after = "") {
171
+	public function wrap($before, $after="") {
172 172
 		if (isset($before)) {
173 173
 			array_unshift($this->_wrapBefore, $before);
174 174
 		}
175
-		$this->_wrapAfter[] = $after;
175
+		$this->_wrapAfter[]=$after;
176 176
 		return $this;
177 177
 	}
178 178
 
179 179
 	public function getElementById($identifier, $elements) {
180
-		return $this->_getElementBy(function (BaseWidget $element) use ($identifier) {
181
-			return $element->getIdentifier() === $identifier;
180
+		return $this->_getElementBy(function(BaseWidget $element) use ($identifier) {
181
+			return $element->getIdentifier()===$identifier;
182 182
 		}, $elements);
183 183
 	}
184 184
 
@@ -187,50 +187,50 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	public function setBsComponent($bsComponent) {
190
-		$this->_bsComponent = $bsComponent;
190
+		$this->_bsComponent=$bsComponent;
191 191
 		return $this;
192 192
 	}
193 193
 
194
-	protected function compile_once(JsUtils $js = NULL, &$view = NULL) {
195
-		if (! $this->_compiled) {
194
+	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
195
+		if (!$this->_compiled) {
196 196
 			if (isset($js)) {
197
-				$beforeCompile = $js->getParam("beforeCompileHtml");
197
+				$beforeCompile=$js->getParam("beforeCompileHtml");
198 198
 				if (\is_callable($beforeCompile)) {
199 199
 					$beforeCompile($this, $js, $view);
200 200
 				}
201 201
 			}
202 202
 			$this->callCallback($this->_preCompile);
203 203
 			unset($this->properties["jsCallback"]);
204
-			$this->_compiled = true;
204
+			$this->_compiled=true;
205 205
 		}
206 206
 	}
207 207
 
208
-	public function compile(JsUtils $js = NULL, &$view = NULL) {
208
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
209 209
 		$this->compile_once($js, $view);
210
-		$result = $this->getTemplate($js, $view);
210
+		$result=$this->getTemplate($js, $view);
211 211
 		foreach ($this as $key => $value) {
212
-			if (\strstr($result, "%{$key}%") !== false) {
212
+			if (\strstr($result, "%{$key}%")!==false) {
213 213
 				if (\is_array($value)) {
214
-					$v = PropertyWrapper::wrap($value, $js, $view);
214
+					$v=PropertyWrapper::wrap($value, $js, $view);
215 215
 				} elseif ($value instanceof \stdClass) {
216
-					$v = \print_r($value, true);
216
+					$v=\print_r($value, true);
217 217
 				} elseif ($value instanceof BaseHtml) {
218
-					$v = $value->compile($js, $view);
218
+					$v=$value->compile($js, $view);
219 219
 				} else {
220
-					$v = $value;
220
+					$v=$value;
221 221
 				}
222
-				$result = \str_replace("%{$key}%", $v ?? '', $result);
222
+				$result=\str_replace("%{$key}%", $v ?? '', $result);
223 223
 			}
224 224
 		}
225
-		if (isset($js) === true) {
225
+		if (isset($js)===true) {
226 226
 			$this->run($js);
227
-			if (isset($view) === true) {
227
+			if (isset($view)===true) {
228 228
 				$js->addViewElement($this->getLibraryId(), $result, $view);
229 229
 			}
230 230
 		}
231 231
 
232 232
 		if (\is_callable($this->_postCompile)) {
233
-			$pc = $this->_postCompile;
233
+			$pc=$this->_postCompile;
234 234
 			$pc($this);
235 235
 		}
236 236
 		return $result;
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
 	 *        	default: ["jsCallback"=>"","jqueryDone"=>"append"]
248 248
 	 * @return \Ajax\common\html\BaseHtml
249 249
 	 */
250
-	public function setDraggable($attr = "id", $dropZone = null, $parameters = []) {
250
+	public function setDraggable($attr="id", $dropZone=null, $parameters=[]) {
251 251
 		$this->setProperty("draggable", "true");
252 252
 		$this->addEvent("dragstart", Javascript::draggable($attr));
253 253
 		if (isset($dropZone) && $dropZone instanceof BaseHtml) {
254
-			$jqueryDone = "append";
255
-			$jsCallback = "";
254
+			$jqueryDone="append";
255
+			$jsCallback="";
256 256
 			extract($parameters);
257 257
 			$dropZone->asDropZone($jsCallback, $jqueryDone, $parameters);
258 258
 		}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 	 * @param array $parameters
268 268
 	 * @return \Ajax\common\html\BaseHtml
269 269
 	 */
270
-	public function asDropZone($jsCallback = "", $jqueryDone = "append", $parameters = []) {
271
-		$stopPropagation = false;
270
+	public function asDropZone($jsCallback="", $jqueryDone="append", $parameters=[]) {
271
+		$stopPropagation=false;
272 272
 		$this->addEvent("dragover", '', $stopPropagation, true);
273 273
 		extract($parameters);
274 274
 		$this->addEvent("drop", Javascript::dropZone($jqueryDone, $jsCallback), $stopPropagation, true);
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 * @param array $parameters
286 286
 	 * @return \Ajax\common\html\BaseHtml
287 287
 	 */
288
-	public function asFileDropZone($responseElement = null, $url = null, $progress = null, $jsCallback = "", $parameters = []) {
289
-		$stopPropagation = false;
290
-		$defaultAjaxAttributes = [
288
+	public function asFileDropZone($responseElement=null, $url=null, $progress=null, $jsCallback="", $parameters=[]) {
289
+		$stopPropagation=false;
290
+		$defaultAjaxAttributes=[
291 291
 			'contentType' => 'false',
292 292
 			'processData' => 'false'
293 293
 		];
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 		extract($parameters);
296 296
 		$this->addEvent("drop", Javascript::fileDropZone($jsCallback), $stopPropagation, true);
297 297
 		if (isset($ajaxAttributes)) {
298
-			$ajaxAttributes += $defaultAjaxAttributes;
298
+			$ajaxAttributes+=$defaultAjaxAttributes;
299 299
 		} else {
300
-			$ajaxAttributes = $defaultAjaxAttributes;
300
+			$ajaxAttributes=$defaultAjaxAttributes;
301 301
 		}
302 302
 		if (isset($progress)) {
303
-			$progress = new HtmlProgress($this->_identifier . '-pg', 0, $progress);
303
+			$progress=new HtmlProgress($this->_identifier.'-pg', 0, $progress);
304 304
 			$progress->setTotal(100);
305 305
 			$this->wrap('', $progress);
306
-			$ajaxAttributes['upload'] = "$('#" . $this->_identifier . "-pg').progress('set percent', Math.ceil(event.loaded/event.total)*100);";
306
+			$ajaxAttributes['upload']="$('#".$this->_identifier."-pg').progress('set percent', Math.ceil(event.loaded/event.total)*100);";
307 307
 		}
308 308
 		if (isset($url)) {
309 309
 			$this->postOn('upload', $url, 'event.target.upload', $responseElement, $ajaxAttributes);
@@ -316,21 +316,21 @@  discard block
 block discarded – undo
316 316
 	}
317 317
 
318 318
 	public function onPostCompile($callback) {
319
-		$this->_postCompile = $callback;
319
+		$this->_postCompile=$callback;
320 320
 	}
321 321
 
322 322
 	public function onPreCompile($callback) {
323
-		$this->_preCompile = $this->addCallback($this->_preCompile, $callback);
323
+		$this->_preCompile=$this->addCallback($this->_preCompile, $callback);
324 324
 	}
325 325
 
326 326
 	private function addCallback($originalValue, $callback) {
327 327
 		if (isset($originalValue)) {
328
-			if (! is_array($originalValue)) {
329
-				$result = [
328
+			if (!is_array($originalValue)) {
329
+				$result=[
330 330
 					$originalValue
331 331
 				];
332 332
 			}
333
-			$result[] = $callback;
333
+			$result[]=$callback;
334 334
 			return $result;
335 335
 		}
336 336
 		return $callback;
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/FieldValidation.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected $customRules;
32 32
 
33
-	protected $hasCustomRules = false;
33
+	protected $hasCustomRules=false;
34 34
 
35 35
 	/**
36 36
 	 *
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	protected $optional;
42 42
 
43 43
 	public function __construct($identifier) {
44
-		$this->identifier = $identifier;
45
-		$this->rules = [];
44
+		$this->identifier=$identifier;
45
+		$this->rules=[];
46 46
 	}
47 47
 
48 48
 	public function getIdentifier() {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	}
51 51
 
52 52
 	public function setIdentifier($identifier) {
53
-		$this->identifier = $identifier;
53
+		$this->identifier=$identifier;
54 54
 		return $this;
55 55
 	}
56 56
 
@@ -65,47 +65,47 @@  discard block
 block discarded – undo
65 65
 	 * @param string $value
66 66
 	 * @return Rule
67 67
 	 */
68
-	public function addRule($type, $prompt = NULL, $value = NULL) {
68
+	public function addRule($type, $prompt=NULL, $value=NULL) {
69 69
 		if ($type instanceof Rule) {
70
-			$rule = $type;
70
+			$rule=$type;
71 71
 			if ($type instanceof CustomRule) {
72
-				$this->customRules[] = $type;
73
-				$this->hasCustomRules = true;
72
+				$this->customRules[]=$type;
73
+				$this->hasCustomRules=true;
74 74
 			}
75 75
 		} elseif (\is_array($type)) {
76
-			$value = JArray::getValue($type, "value", 2);
77
-			$prompt = JArray::getValue($type, "prompt", 1);
78
-			$type = JArray::getValue($type, "type", 0);
79
-			$rule = new Rule($type, $prompt, $value);
76
+			$value=JArray::getValue($type, "value", 2);
77
+			$prompt=JArray::getValue($type, "prompt", 1);
78
+			$type=JArray::getValue($type, "type", 0);
79
+			$rule=new Rule($type, $prompt, $value);
80 80
 		} else {
81
-			$rule = new Rule($type, $prompt, $value);
81
+			$rule=new Rule($type, $prompt, $value);
82 82
 		}
83
-		$this->rules[] = $rule;
83
+		$this->rules[]=$rule;
84 84
 		return $rule;
85 85
 	}
86 86
 
87 87
 	#[\ReturnTypeWillChange]
88 88
 	public function jsonSerialize() {
89
-		$result = [
89
+		$result=[
90 90
 			"identifier" => $this->identifier,
91 91
 			"rules" => $this->rules
92 92
 		];
93 93
 		if ($this->optional) {
94
-			$result["optional"] = true;
94
+			$result["optional"]=true;
95 95
 		}
96 96
 		if (isset($this->depends)) {
97
-			$result["depends"] = $this->depends;
97
+			$result["depends"]=$this->depends;
98 98
 		}
99 99
 		return $result;
100 100
 	}
101 101
 
102 102
 	public function setDepends($depends) {
103
-		$this->depends = $depends;
103
+		$this->depends=$depends;
104 104
 		return $this;
105 105
 	}
106 106
 
107 107
 	public function setOptional($optional) {
108
-		$this->optional = $optional;
108
+		$this->optional=$optional;
109 109
 		return $this;
110 110
 	}
111 111
 
Please login to merge, or discard this patch.
Ajax/semantic/components/validation/Rule.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @version 1.001
9 9
  * Generates a JSON Rule for the validation of a field
10 10
  */
11
-class Rule implements \JsonSerializable{
11
+class Rule implements \JsonSerializable {
12 12
 	/**
13 13
 	 * @var string
14 14
 	 */
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	private $value;
25 25
 
26
-	public function __construct($type,$prompt=NULL,$value=NULL){
26
+	public function __construct($type, $prompt=NULL, $value=NULL) {
27 27
 		$this->type=$type;
28 28
 		$this->prompt=$prompt;
29 29
 		$this->value=$value;
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 
59 59
 	#[\ReturnTypeWillChange]
60 60
 	public function jsonSerialize() {
61
-		$result= ["type"=>$this->type];
62
-		if(isset($this->prompt))
61
+		$result=["type"=>$this->type];
62
+		if (isset($this->prompt))
63 63
 			$result["prompt"]=$this->prompt;
64
-		if(isset($this->value))
64
+		if (isset($this->value))
65 65
 			$result["value"]=$this->value;
66 66
 		return $result;
67 67
 	}
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param string $prompt
73 73
 	 * @return \Ajax\semantic\components\validation\Rule
74 74
 	 */
75
-	public static function match($name,$prompt=NULL){
76
-		return new Rule("match[".$name."]",$prompt);
75
+	public static function match($name, $prompt=NULL) {
76
+		return new Rule("match[".$name."]", $prompt);
77 77
 	}
78 78
 
79 79
 	/**
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	 * @param string $prompt
83 83
 	 * @return \Ajax\semantic\components\validation\Rule
84 84
 	 */
85
-	public static function different($name,$prompt=NULL){
86
-		return new Rule("different[".$name."]",$prompt);
85
+	public static function different($name, $prompt=NULL) {
86
+		return new Rule("different[".$name."]", $prompt);
87 87
 	}
88 88
 
89 89
 	/**
@@ -93,82 +93,82 @@  discard block
 block discarded – undo
93 93
 	 * @param string $prompt
94 94
 	 * @return \Ajax\semantic\components\validation\Rule
95 95
 	 */
96
-	public static function integer($min=NULL,$max=NULL,$prompt=NULL){
97
-		if(\is_int($min) && \is_int($max))
98
-			return new Rule("integer[{$min}..{$max}]",$prompt);
99
-		return new Rule("integer",$prompt);
96
+	public static function integer($min=NULL, $max=NULL, $prompt=NULL) {
97
+		if (\is_int($min) && \is_int($max))
98
+			return new Rule("integer[{$min}..{$max}]", $prompt);
99
+		return new Rule("integer", $prompt);
100 100
 	}
101 101
 
102
-	public static function decimal($prompt=NULL){
103
-		return new Rule("decimal",$prompt);
102
+	public static function decimal($prompt=NULL) {
103
+		return new Rule("decimal", $prompt);
104 104
 	}
105 105
 
106
-	public static function number($prompt=NULL){
107
-		return new Rule("number",$prompt);
106
+	public static function number($prompt=NULL) {
107
+		return new Rule("number", $prompt);
108 108
 	}
109 109
 
110
-	public static function is($value,$prompt=NULL){
111
-		return new Rule("is[".$value."]",$prompt);
110
+	public static function is($value, $prompt=NULL) {
111
+		return new Rule("is[".$value."]", $prompt);
112 112
 	}
113 113
 
114
-	public static function isExactly($value,$prompt=NULL){
115
-		return new Rule("isExactly[".$value."]",$prompt);
114
+	public static function isExactly($value, $prompt=NULL) {
115
+		return new Rule("isExactly[".$value."]", $prompt);
116 116
 	}
117 117
 
118
-	public static function not($value,$prompt=NULL){
119
-		return new Rule("not[".$value."]",$prompt);
118
+	public static function not($value, $prompt=NULL) {
119
+		return new Rule("not[".$value."]", $prompt);
120 120
 	}
121 121
 
122
-	public static function notExactly($value,$prompt=NULL){
123
-		return new Rule("notExactly[".$value."]",$prompt);
122
+	public static function notExactly($value, $prompt=NULL) {
123
+		return new Rule("notExactly[".$value."]", $prompt);
124 124
 	}
125 125
 
126
-	public static function contains($value,$prompt=NULL){
127
-		return new Rule("contains[".$value."]",$prompt);
126
+	public static function contains($value, $prompt=NULL) {
127
+		return new Rule("contains[".$value."]", $prompt);
128 128
 	}
129 129
 
130
-	public static function containsExactly($value,$prompt=NULL){
131
-		return new Rule("containsExactly[".$value."]",$prompt);
130
+	public static function containsExactly($value, $prompt=NULL) {
131
+		return new Rule("containsExactly[".$value."]", $prompt);
132 132
 	}
133 133
 
134
-	public static function doesntContain($value,$prompt=NULL){
135
-		return new Rule("doesntContain[".$value."]",$prompt);
134
+	public static function doesntContain($value, $prompt=NULL) {
135
+		return new Rule("doesntContain[".$value."]", $prompt);
136 136
 	}
137 137
 
138
-	public static function doesntContainExactly($value,$prompt=NULL){
139
-		return new Rule("doesntContainExactly[".$value."]",$prompt);
138
+	public static function doesntContainExactly($value, $prompt=NULL) {
139
+		return new Rule("doesntContainExactly[".$value."]", $prompt);
140 140
 	}
141 141
 
142
-	public static function minCount($value,$prompt=NULL){
143
-		return new Rule("minCount[".$value."]",$prompt);
142
+	public static function minCount($value, $prompt=NULL) {
143
+		return new Rule("minCount[".$value."]", $prompt);
144 144
 	}
145 145
 
146
-	public static function maxCount($value,$prompt=NULL){
147
-		return new Rule("maxCount[".$value."]",$prompt);
146
+	public static function maxCount($value, $prompt=NULL) {
147
+		return new Rule("maxCount[".$value."]", $prompt);
148 148
 	}
149 149
 
150
-	public static function exactCount($value,$prompt=NULL){
151
-		return new Rule("exactCount[".$value."]",$prompt);
150
+	public static function exactCount($value, $prompt=NULL) {
151
+		return new Rule("exactCount[".$value."]", $prompt);
152 152
 	}
153 153
 
154
-	public static function email($prompt=NULL){
155
-		return new Rule("email",$prompt);
154
+	public static function email($prompt=NULL) {
155
+		return new Rule("email", $prompt);
156 156
 	}
157 157
 
158
-	public static function url($prompt=NULL){
159
-		return new Rule("url",$prompt);
158
+	public static function url($prompt=NULL) {
159
+		return new Rule("url", $prompt);
160 160
 	}
161 161
 
162
-	public static function regExp($value,$prompt=NULL){
163
-		return new Rule("regExp",$prompt,$value);
162
+	public static function regExp($value, $prompt=NULL) {
163
+		return new Rule("regExp", $prompt, $value);
164 164
 	}
165 165
 
166
-	public static function custom($name,$jsFunction){
167
-		return "$.fn.form.settings.rules.".$name." =".$jsFunction ;
166
+	public static function custom($name, $jsFunction) {
167
+		return "$.fn.form.settings.rules.".$name." =".$jsFunction;
168 168
 	}
169 169
 
170
-	public static function ajax(JsUtils $js,$name,$url,$params,$jsCallback,$method="post",$parameters=[]){
171
-		$parameters=\array_merge(["async"=>false,"url"=>$url,"params"=>$params,"hasLoader"=>false,"jsCallback"=>$jsCallback,"dataType"=>"json","stopPropagation"=>false,"preventDefault"=>false,"responseElement"=>null],$parameters);
170
+	public static function ajax(JsUtils $js, $name, $url, $params, $jsCallback, $method="post", $parameters=[]) {
171
+		$parameters=\array_merge(["async"=>false, "url"=>$url, "params"=>$params, "hasLoader"=>false, "jsCallback"=>$jsCallback, "dataType"=>"json", "stopPropagation"=>false, "preventDefault"=>false, "responseElement"=>null], $parameters);
172 172
 		$ajax=new AjaxCall($method, $parameters);
173 173
 		return self::custom($name, "function(value,ruleValue){var result=true;".$ajax->compile($js)."return result;}");
174 174
 	}
Please login to merge, or discard this patch.