Completed
Push — master ( 0a6efd...18e8f7 )
by Jean-Christophe
02:37
created
Ajax/semantic/html/content/table/HtmlTableContent.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  *
12 12
  */
13 13
 class HtmlTableContent extends HtmlSemCollection {
14
-	protected $_tdTagNames=[ "thead" => "th","tbody" => "td","tfoot" => "th" ];
14
+	protected $_tdTagNames=["thead" => "th", "tbody" => "td", "tfoot" => "th"];
15 15
 
16 16
 	/**
17 17
 	 *
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function setRowCount($rowCount, $colCount) {
36 36
 		$count=$this->count();
37
-		for($i=$count; $i < $rowCount; $i++) {
37
+		for ($i=$count; $i<$rowCount; $i++) {
38 38
 			$this->addItem($colCount);
39 39
 		}
40 40
 		return $this;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$tr=new HtmlTR("", $value);
57 57
 		$tr->setContainer($this, $count);
58 58
 		$tr->setTdTagName($this->_tdTagNames[$this->tagName]);
59
-		if (isset($value) === true) {
59
+		if (isset($value)===true) {
60 60
 			$tr->setColCount($value);
61 61
 		}
62 62
 		return $tr;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setCellValue($row, $col, $value="") {
116 116
 		$cell=$this->getCell($row, $col);
117
-		if (isset($cell) === true) {
117
+		if (isset($cell)===true) {
118 118
 			$cell->setValue($value);
119 119
 		}
120 120
 		return $this;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @param mixed $values
126 126
 	 */
127 127
 	public function setValues($values=array()) {
128
-		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);});
128
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->setValues($_values); });
129 129
 	}
130 130
 
131 131
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @param mixed $values
134 134
 	 */
135 135
 	public function addValues($values=array()) {
136
-		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);});
136
+		return $this->_addOrSetValues($values, function(HtmlTR $row, $_values) {$row->addValues($_values); });
137 137
 	}
138 138
 
139 139
 	/**
@@ -141,21 +141,21 @@  discard block
 block discarded – undo
141 141
 	 * @param mixed $values
142 142
 	 * @param callable $callback
143 143
 	 */
144
-	protected function _addOrSetValues($values,$callback) {
144
+	protected function _addOrSetValues($values, $callback) {
145 145
 		$count=$this->count();
146 146
 		$isArray=true;
147 147
 		if (!\is_array($values)) {
148 148
 			$values=\array_fill(0, $count, $values);
149 149
 			$isArray=false;
150 150
 		}
151
-		if (JArray::dimension($values) == 1 && $isArray)
152
-			$values=[ $values ];
151
+		if (JArray::dimension($values)==1 && $isArray)
152
+			$values=[$values];
153 153
 
154 154
 		$count=\min(\sizeof($values), $count);
155 155
 
156
-		for($i=0; $i < $count; $i++) {
156
+		for ($i=0; $i<$count; $i++) {
157 157
 			$row=$this->content[$i];
158
-			$callback($row,$values[$i]);
158
+			$callback($row, $values[$i]);
159 159
 		}
160 160
 		return $this;
161 161
 	}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			$values=\array_fill(0, $count, $values);
167 167
 		}
168 168
 		$count=\min(\sizeof($values), $count);
169
-		for($i=0; $i < $count; $i++) {
169
+		for ($i=0; $i<$count; $i++) {
170 170
 			$this->getCell($i, $colIndex)->setValue($values[$i]);
171 171
 		}
172 172
 		return $this;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 	public function addColVariations($colIndex, $variations=array()) {
176 176
 		$count=$this->count();
177
-		for($i=0; $i < $count; $i++) {
177
+		for ($i=0; $i<$count; $i++) {
178 178
 			$this->getCell($i, $colIndex)->addVariations($variations);
179 179
 		}
180 180
 		return $this;
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 
192 192
 	private function colAlign($colIndex, $function) {
193 193
 		$count=$this->count();
194
-		for($i=0; $i < $count; $i++) {
194
+		for ($i=0; $i<$count; $i++) {
195 195
 			$index=$this->content[$i]->getColPosition($colIndex);
196
-			if ($index !== NULL)
196
+			if ($index!==NULL)
197 197
 				$this->getCell($i, $index)->$function();
198 198
 		}
199 199
 		return $this;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 */
226 226
 	public function getColCount() {
227 227
 		$result=0;
228
-		if ($this->count() > 0)
228
+		if ($this->count()>0)
229 229
 			$result=$this->getItem(0)->count();
230 230
 		return $result;
231 231
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	public function delete($rowIndex, $colIndex=NULL) {
240 240
 		if (isset($colIndex)) {
241 241
 			$row=$this->getItem($rowIndex);
242
-			if (isset($row) === true) {
242
+			if (isset($row)===true) {
243 243
 				$row->delete($colIndex);
244 244
 			}
245 245
 		} else {
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 		return $this;
249 249
 	}
250 250
 
251
-	public function toDelete($rowIndex, $colIndex){
251
+	public function toDelete($rowIndex, $colIndex) {
252 252
 		$row=$this->getItem($rowIndex);
253
-		if (isset($row) === true)
253
+		if (isset($row)===true)
254 254
 			$row->toDelete($colIndex);
255 255
 		return $this;
256 256
 	}
@@ -279,17 +279,17 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function conditionalCellFormat($callback, $format) {
281 281
 		$rows=$this->content;
282
-		foreach ( $rows as $row ) {
282
+		foreach ($rows as $row) {
283 283
 			$row->conditionalCellFormat($callback, $format);
284 284
 		}
285 285
 		return $this;
286 286
 	}
287 287
 
288
-	public function conditionalColFormat($colIndex,$callback,$format){
288
+	public function conditionalColFormat($colIndex, $callback, $format) {
289 289
 		$rows=$this->content;
290
-		foreach ( $rows as $row ) {
290
+		foreach ($rows as $row) {
291 291
 			$cell=$row->getItem($colIndex);
292
-			$cell->conditionnalCellFormat($callback,$format);
292
+			$cell->conditionnalCellFormat($callback, $format);
293 293
 		}
294 294
 		return $this;
295 295
 	}
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function conditionalRowFormat($callback, $format) {
303 303
 		$rows=$this->content;
304
-		foreach ( $rows as $row ) {
304
+		foreach ($rows as $row) {
305 305
 			$row->conditionalRowFormat($callback, $format);
306 306
 		}
307 307
 		return $this;
308 308
 	}
309 309
 
310
-	public function hideColumn($colIndex){
310
+	public function hideColumn($colIndex) {
311 311
 		$rows=$this->content;
312
-		foreach ( $rows as $row ) {
312
+		foreach ($rows as $row) {
313 313
 			$cell=$row->getItem($colIndex);
314
-			$cell->addToProperty("style","display:none;");
314
+			$cell->addToProperty("style", "display:none;");
315 315
 		}
316 316
 		return $this;
317 317
 	}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 */
323 323
 	public function applyCells($callback) {
324 324
 		$rows=$this->content;
325
-		foreach ( $rows as $row ) {
325
+		foreach ($rows as $row) {
326 326
 			$row->applyCells($callback);
327 327
 		}
328 328
 		return $this;
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
 	 */
335 335
 	public function applyRows($callback) {
336 336
 		$rows=$this->content;
337
-		foreach ( $rows as $row ) {
337
+		foreach ($rows as $row) {
338 338
 			$row->apply($callback);
339 339
 		}
340 340
 		return $this;
341 341
 	}
342 342
 
343
-	public function mergeIdentiqualValues($colIndex,$function="strip_tags"){
343
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
344 344
 		$rows=$this->content;
345 345
 		$identiqual=null;
346 346
 		$counter=0;
347 347
 		$cellToMerge=null;
348 348
 		$functionExists=\function_exists($function);
349
-		foreach ( $rows as $row ) {
349
+		foreach ($rows as $row) {
350 350
 			$cell=$row->getItem($colIndex);
351 351
 			$value=$cell->getContent();
352
-			if($functionExists)
353
-				$value=\call_user_func($function,$value);
354
-			if($value!==$identiqual){
355
-				if($counter>0 && isset($cellToMerge)){
352
+			if ($functionExists)
353
+				$value=\call_user_func($function, $value);
354
+			if ($value!==$identiqual) {
355
+				if ($counter>0 && isset($cellToMerge)) {
356 356
 					$cellToMerge->setRowspan($counter);
357 357
 				}
358 358
 				$counter=0;
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function __construct($identifier, $tagName="tbody", $rowCount=NULL, $colCount=NULL) {
24 24
 		parent::__construct($identifier, $tagName, "");
25
-		if (isset($rowCount) && isset($colCount))
26
-			$this->setRowCount($rowCount, $colCount);
25
+		if (isset($rowCount) && isset($colCount)) {
26
+					$this->setRowCount($rowCount, $colCount);
27
+		}
27 28
 	}
28 29
 
29 30
 	/**
@@ -148,8 +149,9 @@  discard block
 block discarded – undo
148 149
 			$values=\array_fill(0, $count, $values);
149 150
 			$isArray=false;
150 151
 		}
151
-		if (JArray::dimension($values) == 1 && $isArray)
152
-			$values=[ $values ];
152
+		if (JArray::dimension($values) == 1 && $isArray) {
153
+					$values=[ $values ];
154
+		}
153 155
 
154 156
 		$count=\min(\sizeof($values), $count);
155 157
 
@@ -193,8 +195,9 @@  discard block
 block discarded – undo
193 195
 		$count=$this->count();
194 196
 		for($i=0; $i < $count; $i++) {
195 197
 			$index=$this->content[$i]->getColPosition($colIndex);
196
-			if ($index !== NULL)
197
-				$this->getCell($i, $index)->$function();
198
+			if ($index !== NULL) {
199
+							$this->getCell($i, $index)->$function();
200
+			}
198 201
 		}
199 202
 		return $this;
200 203
 	}
@@ -225,8 +228,9 @@  discard block
 block discarded – undo
225 228
 	 */
226 229
 	public function getColCount() {
227 230
 		$result=0;
228
-		if ($this->count() > 0)
229
-			$result=$this->getItem(0)->count();
231
+		if ($this->count() > 0) {
232
+					$result=$this->getItem(0)->count();
233
+		}
230 234
 		return $result;
231 235
 	}
232 236
 
@@ -250,8 +254,9 @@  discard block
 block discarded – undo
250 254
 
251 255
 	public function toDelete($rowIndex, $colIndex){
252 256
 		$row=$this->getItem($rowIndex);
253
-		if (isset($row) === true)
254
-			$row->toDelete($colIndex);
257
+		if (isset($row) === true) {
258
+					$row->toDelete($colIndex);
259
+		}
255 260
 		return $this;
256 261
 	}
257 262
 
@@ -349,8 +354,9 @@  discard block
 block discarded – undo
349 354
 		foreach ( $rows as $row ) {
350 355
 			$cell=$row->getItem($colIndex);
351 356
 			$value=$cell->getContent();
352
-			if($functionExists)
353
-				$value=\call_user_func($function,$value);
357
+			if($functionExists) {
358
+							$value=\call_user_func($function,$value);
359
+			}
354 360
 			if($value!==$identiqual){
355 361
 				if($counter>0 && isset($cellToMerge)){
356 362
 					$cellToMerge->setRowspan($counter);
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function getColCount(){
35
+	public function getColCount() {
36 36
 		return $this->count();
37 37
 	}
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param mixed $values
69 69
 	 */
70 70
 	public function setValues($values=array()) {
71
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->setValue($value);});
71
+		return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {$cell->setValue($value); });
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $values
77 77
 	 */
78 78
 	public function addValues($values=array()) {
79
-		return $this->_addOrSetValues($values, function(HtmlTD &$cell,$value){$cell->addValue($value);});
79
+		return $this->_addOrSetValues($values, function(HtmlTD&$cell, $value) {$cell->addValue($value); });
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * Sets or adds values to the row cols
84 84
 	 * @param mixed $values
85 85
 	 */
86
-	protected function _addOrSetValues($values,$callback) {
86
+	protected function _addOrSetValues($values, $callback) {
87 87
 		$count=$this->count();
88 88
 		if (!\is_array($values)) {
89 89
 			$values=\array_fill(0, $count, $values);
90 90
 		} else {
91
-			if (JArray::isAssociative($values) === true) {
91
+			if (JArray::isAssociative($values)===true) {
92 92
 				$values=\array_values($values);
93 93
 			}
94 94
 		}
95 95
 		$count=\min(\sizeof($values), $count);
96 96
 
97
-		for($i=0; $i < $count; $i++) {
97
+		for ($i=0; $i<$count; $i++) {
98 98
 			$cell=$this->content[$i];
99
-			$callback($cell,$values[$i]);
99
+			$callback($cell, $values[$i]);
100 100
 		}
101 101
 		return $this;
102 102
 	}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	public function getColPosition($colIndex) {
123 123
 		$pos=0;
124 124
 		$rows=$this->_container->getContent();
125
-		for($i=0; $i < $this->_row; $i++) {
125
+		for ($i=0; $i<$this->_row; $i++) {
126 126
 			$max=\min($colIndex, $rows[$i]->count());
127
-			for($j=0; $j < $max; $j++) {
127
+			for ($j=0; $j<$max; $j++) {
128 128
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
129
-				if ($rowspan + $i > $this->_row)
129
+				if ($rowspan+$i>$this->_row)
130 130
 					$pos++;
131 131
 			}
132 132
 		}
133
-		if ($pos > $colIndex)
133
+		if ($pos>$colIndex)
134 134
 			return NULL;
135 135
 		$count=$this->count();
136
-		for($i=0; $i < $count; $i++) {
136
+		for ($i=0; $i<$count; $i++) {
137 137
 			$pos+=$this->content[$i]->getColspan();
138
-			if ($pos >= $colIndex + 1)
138
+			if ($pos>=$colIndex+1)
139 139
 				return $i;
140 140
 		}
141 141
 		return null;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 	public function conditionalCellFormat($callback, $format) {
145 145
 		$cells=$this->content;
146
-		foreach ( $cells as $cell ) {
146
+		foreach ($cells as $cell) {
147 147
 			$cell->conditionalCellFormat($callback, $format);
148 148
 		}
149 149
 		return $this;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 
159 159
 	public function containsStr($needle) {
160 160
 		$cells=$this->content;
161
-		foreach ( $cells as $cell ) {
162
-			if (\strpos($cell->getContent(), $needle) !== false)
161
+		foreach ($cells as $cell) {
162
+			if (\strpos($cell->getContent(), $needle)!==false)
163 163
 				return true;
164 164
 		}
165 165
 		return false;
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 
173 173
 	public function applyCells($callback) {
174 174
 		$cells=$this->content;
175
-		foreach ( $cells as $cell ) {
175
+		foreach ($cells as $cell) {
176 176
 			$cell->apply($callback);
177 177
 		}
178 178
 		return $this;
179 179
 	}
180 180
 
181
-	public function toDelete($colIndex){
181
+	public function toDelete($colIndex) {
182 182
 		$this->getItem($colIndex)->toDelete();
183 183
 		return $this;
184 184
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTD.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use Ajax\JsUtils;
13 13
 
14 14
 class HtmlTD extends HtmlSemDoubleElement {
15
-	use TextAlignmentTrait,TableElementTrait;
15
+	use TextAlignmentTrait, TableElementTrait;
16 16
 	private $_container;
17 17
 	private $_row;
18 18
 	private $_col;
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct($identifier, $content=NULL, $tagName="td") {
30 30
 		parent::__construct($identifier, $tagName, "", $content);
31
-		$this->_variations=[ Variation::COLLAPSING ];
32
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
31
+		$this->_variations=[Variation::COLLAPSING];
32
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
33 33
 	}
34 34
 
35 35
 	public function setContainer($container, $row, $col) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setRowspan($rowspan) {
52
-		$to=min($this->_container->count(), $this->_row + $rowspan - 1);
53
-		for($i=$to; $i > $this->_row; $i--) {
52
+		$to=min($this->_container->count(), $this->_row+$rowspan-1);
53
+		for ($i=$to; $i>$this->_row; $i--) {
54 54
 			$this->_container->toDelete($i, $this->_col);
55 55
 		}
56 56
 		$this->setProperty("rowspan", $rowspan);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	public function mergeRow() {
61
-		if(!$this->_rowMerged){
61
+		if (!$this->_rowMerged) {
62 62
 			$this->_rowMerged=true;
63 63
 			return $this->setRowspan($this->_container->count());
64 64
 		}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public function mergeCol() {
69
-		if(!$this->_colMerged){
69
+		if (!$this->_colMerged) {
70 70
 			$this->_colMerged=true;
71 71
 			return $this->setColspan($this->_container->getRow($this->_row)->count());
72 72
 		}
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	}
75 75
 
76 76
 	public function setColspan($colspan) {
77
-		$to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1);
78
-		for($i=$to; $i > $this->_col; $i--) {
79
-			$this->_container->toDelete($this->_row, $this->_col + 1);
77
+		$to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1);
78
+		for ($i=$to; $i>$this->_col; $i--) {
79
+			$this->_container->toDelete($this->_row, $this->_col+1);
80 80
 		}
81 81
 		$this->setProperty("colspan", $colspan);
82 82
 		return $this->_container;
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
 		return $this->addToProperty("class", "selectable");
116 116
 	}
117 117
 
118
-	public function setWidth($width){
118
+	public function setWidth($width) {
119 119
 		if (\is_int($width)) {
120
-			$width=Wide::getConstants()["W" . $width];
120
+			$width=Wide::getConstants()["W".$width];
121 121
 		}
122 122
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
123
-		return $this->addToPropertyCtrl("class", "wide", array ("wide" ));
123
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
124 124
 	}
125 125
 
126
-	public function toDelete(){
126
+	public function toDelete() {
127 127
 		$this->_deleted=true;
128 128
 		return $this;
129 129
 	}
130 130
 
131 131
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
132
-		if(!$this->_deleted)
132
+		if (!$this->_deleted)
133 133
 			return parent::compile();
134 134
 		return;
135 135
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,15 +84,17 @@  discard block
 block discarded – undo
84 84
 
85 85
 	public function getColspan() {
86 86
 		$colspan=1;
87
-		if (\array_key_exists("colspan", $this->properties))
88
-			$colspan=$this->getProperty("colspan");
87
+		if (\array_key_exists("colspan", $this->properties)) {
88
+					$colspan=$this->getProperty("colspan");
89
+		}
89 90
 		return $colspan;
90 91
 	}
91 92
 
92 93
 	public function getRowspan() {
93 94
 		$rowspan=1;
94
-		if (\array_key_exists("rowspan", $this->properties))
95
-			$rowspan=$this->getProperty("rowspan");
95
+		if (\array_key_exists("rowspan", $this->properties)) {
96
+					$rowspan=$this->getProperty("rowspan");
97
+		}
96 98
 		return $rowspan;
97 99
 	}
98 100
 
@@ -129,8 +131,9 @@  discard block
 block discarded – undo
129 131
 	}
130 132
 
131 133
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
132
-		if(!$this->_deleted)
133
-			return parent::compile();
134
+		if(!$this->_deleted) {
135
+					return parent::compile();
136
+		}
134 137
 		return;
135 138
 	}
136 139
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 
29 29
 	public function __construct($identifier, $rowCount, $colCount) {
30 30
 		parent::__construct($identifier, "table", "ui table");
31
-		$this->content=array ();
31
+		$this->content=array();
32 32
 		$this->setRowCount($rowCount, $colCount);
33
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
34
-		$this->_compileParts=["thead","tbody","tfoot"];
33
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
34
+		$this->_compileParts=["thead", "tbody", "tfoot"];
35 35
 		$this->_afterCompileEvents=[];
36 36
 	}
37 37
 
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 	 * @return HtmlTableContent
42 42
 	 */
43 43
 	public function getPart($key) {
44
-		if (\array_key_exists($key, $this->content) === false) {
44
+		if (\array_key_exists($key, $this->content)===false) {
45 45
 			$this->content[$key]=new HtmlTableContent("", $key);
46
-			if ($key !== "tbody") {
46
+			if ($key!=="tbody") {
47 47
 				$this->content[$key]->setRowCount(1, $this->_colCount);
48 48
 			}
49 49
 		}
50 50
 		return $this->content[$key];
51 51
 	}
52 52
 
53
-	protected function _getFirstPart(){
54
-		if(isset($this->content["thead"])){
53
+	protected function _getFirstPart() {
54
+		if (isset($this->content["thead"])) {
55 55
 			return $this->content["thead"];
56 56
 		}
57 57
 		return $this->content["tbody"];
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return boolean
97 97
 	 */
98 98
 	public function hasPart($key) {
99
-		return \array_key_exists($key, $this->content) === true;
99
+		return \array_key_exists($key, $this->content)===true;
100 100
 	}
101 101
 
102 102
 	/**
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 		return $this->colAlign($colIndex, "colLeft");
230 230
 	}
231 231
 
232
-	public function setColAlignment($colIndex,$alignment){
233
-		switch ($alignment){
232
+	public function setColAlignment($colIndex, $alignment) {
233
+		switch ($alignment) {
234 234
 			case TextAlignment::LEFT:
235 235
 				$function="colLeft";
236 236
 				break;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 	private function colAlign($colIndex, $function) {
250 250
 		if (\is_array($colIndex)) {
251
-			foreach ( $colIndex as $cIndex ) {
251
+			foreach ($colIndex as $cIndex) {
252 252
 				$this->colAlign($cIndex, $function);
253 253
 			}
254 254
 		} else {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @see HtmlSemDoubleElement::compile()
310 310
 	 */
311 311
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
312
-		if(\sizeof($this->_compileParts)<3){
312
+		if (\sizeof($this->_compileParts)<3) {
313 313
 			$this->_template="%content%";
314 314
 			$this->refresh();
315 315
 		}
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	}
319 319
 
320 320
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
321
-		parent::compile_once($js,$view);
321
+		parent::compile_once($js, $view);
322 322
 		if ($this->propertyContains("class", "sortable")) {
323
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
323
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
324 324
 		}
325
-		if(isset($this->_activeRowSelector)){
325
+		if (isset($this->_activeRowSelector)) {
326 326
 			$this->_activeRowSelector->compile();
327 327
 		}
328 328
 	}
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	public function fromDatabaseObject($object, $function) {
337 337
 		$result=$function($object);
338 338
 		if (\is_array($result)) {
339
-			$result= $this->addRow($function($object));
339
+			$result=$this->addRow($function($object));
340 340
 		} else {
341
-			$result= $this->getBody()->_addRow($result);
341
+			$result=$this->getBody()->_addRow($result);
342 342
 		}
343
-		if(isset($this->_afterCompileEvents["onNewRow"])){
344
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
345
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
343
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
344
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
345
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
346 346
 		}
347 347
 		return $result;
348 348
 	}
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
 		return $this;
358 358
 	}
359 359
 
360
-	public function refresh(){
360
+	public function refresh() {
361 361
 		$this->_footer=$this->getFooter();
362 362
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
363 363
 	}
364 364
 
365
-	public function run(JsUtils $js){
366
-		$result= parent::run($js);
367
-		if(isset($this->_footer))
365
+	public function run(JsUtils $js) {
366
+		$result=parent::run($js);
367
+		if (isset($this->_footer))
368 368
 			$this->_footer->run($js);
369 369
 		return $result;
370 370
 	}
@@ -387,47 +387,47 @@  discard block
 block discarded – undo
387 387
 	 * @param boolean $multiple
388 388
 	 * @return HtmlTable
389 389
 	 */
390
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
391
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
390
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
391
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
392 392
 		return $this;
393 393
 	}
394 394
 
395
-	public function hideColumn($colIndex){
396
-		if(isset($this->content["thead"])){
395
+	public function hideColumn($colIndex) {
396
+		if (isset($this->content["thead"])) {
397 397
 			$this->content["thead"]->hideColumn($colIndex);
398 398
 		}
399 399
 		$this->content["tbody"]->hideColumn($colIndex);
400
-		if(isset($this->content["tfoot"])){
400
+		if (isset($this->content["tfoot"])) {
401 401
 			$this->content["tfoot"]->hideColumn($colIndex);
402 402
 		}
403 403
 		return $this;
404 404
 	}
405 405
 
406
-	public function setColWidth($colIndex,$width){
406
+	public function setColWidth($colIndex, $width) {
407 407
 		$part=$this->_getFirstPart();
408
-		if($part!==null && $part->count()>0)
408
+		if ($part!==null && $part->count()>0)
409 409
 			$part->getCell(0, $colIndex)->setWidth($width);
410 410
 		return $this;
411 411
 	}
412 412
 
413
-	public function setColWidths($widths){
413
+	public function setColWidths($widths) {
414 414
 		$part=$this->_getFirstPart();
415
-		if($part!==null && $part->count()>0){
415
+		if ($part!==null && $part->count()>0) {
416 416
 			$count=$part->getColCount();
417
-			if(!\is_array($widths)){
417
+			if (!\is_array($widths)) {
418 418
 				$widths=\array_fill(0, $count, $widths);
419 419
 			}
420
-			$max=\min(\sizeof($widths),$count);
421
-			for($i=0;$i<$max;$i++){
420
+			$max=\min(\sizeof($widths), $count);
421
+			for ($i=0; $i<$max; $i++) {
422 422
 				$part->getCell(0, $i)->setWidth($widths[$i]);
423 423
 			}
424 424
 		}
425 425
 		return $this;
426 426
 	}
427 427
 
428
-	public function mergeIdentiqualValues($colIndex,$function="strip_tags"){
428
+	public function mergeIdentiqualValues($colIndex, $function="strip_tags") {
429 429
 		$body=$this->getBody();
430
-		$body->mergeIdentiqualValues($colIndex,$function);
430
+		$body->mergeIdentiqualValues($colIndex, $function);
431 431
 		return $this;
432 432
 	}
433 433
 }
Please login to merge, or discard this patch.