Completed
Push — master ( e76efc...a384bc )
by Jean-Christophe
04:08
created
Ajax/semantic/html/collections/HtmlGrid.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 			// }
33 33
 			$this->setWide($numCols);
34 34
 		}
35
-		if($createCols)
35
+		if ($createCols)
36 36
 			$this->setRowsCount($numRows, $numCols);
37 37
 	}
38 38
 
39 39
 	public function asSegment() {
40
-		return $this->addToPropertyCtrl("class", "segment", array ("segment" ));
40
+		return $this->addToPropertyCtrl("class", "segment", array("segment"));
41 41
 	}
42 42
 
43 43
 	public function asContainer() {
44
-		return $this->addToPropertyCtrl("class", "container", array ("container" ));
44
+		return $this->addToPropertyCtrl("class", "container", array("container"));
45 45
 	}
46 46
 
47 47
 	/**
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
 	 * @param int $wide
50 50
 	 */
51 51
 	public function setWide($wide) {
52
-		if(isset(Wide::getConstants()["W" . $wide])){
53
-			$wide=Wide::getConstants()["W" . $wide];
52
+		if (isset(Wide::getConstants()["W".$wide])) {
53
+			$wide=Wide::getConstants()["W".$wide];
54 54
 			$this->addToPropertyCtrl("class", $wide, Wide::getConstants());
55
-			return $this->addToPropertyCtrl("class", "column", array ("column" ));
55
+			return $this->addToPropertyCtrl("class", "column", array("column"));
56 56
 		}
57 57
 		return $this;
58 58
 	}
59 59
 	
60
-	public function setColWidth($numCol,$width){
61
-		foreach ($this->content as $row){
60
+	public function setColWidth($numCol, $width) {
61
+		foreach ($this->content as $row) {
62 62
 			$row->getCol($numCol)->setWidth($width);
63 63
 		}
64 64
 	}
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	 * @return mixed
79 79
 	 */
80 80
 	public function addRow($colsCount=NULL) {
81
-		$rowCount=$this->rowCount() + 1;
81
+		$rowCount=$this->rowCount()+1;
82 82
 		$this->setRowsCount($rowCount, $colsCount, true);
83
-		return $this->content[$rowCount - 1];
83
+		return $this->content[$rowCount-1];
84 84
 	}
85 85
 
86 86
 	/**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	 * @return mixed|\Ajax\semantic\html\collections\HtmlGrid
90 90
 	 */
91 91
 	public function addCol($width=NULL) {
92
-		$colCount=$this->colCount() + 1;
92
+		$colCount=$this->colCount()+1;
93 93
 		$this->setColsCount($colCount, true, $width);
94 94
 		if ($this->hasOnlyCols($this->count()))
95
-			return $this->content[$colCount - 1];
95
+			return $this->content[$colCount-1];
96 96
 		return $this;
97 97
 	}
98 98
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
103 103
 	 */
104 104
 	public function addCols($sizes=array()) {
105
-		foreach ( $sizes as $size ) {
105
+		foreach ($sizes as $size) {
106 106
 			$this->addCol($size);
107 107
 		}
108 108
 		return $this;
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) {
118 118
 		$count=$this->count();
119
-		if ($rowsCount < 2 && $force === false) {
120
-			for($i=$count; $i < $colsCount; $i++) {
121
-				$this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i));
119
+		if ($rowsCount<2 && $force===false) {
120
+			for ($i=$count; $i<$colsCount; $i++) {
121
+				$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
122 122
 			}
123 123
 		} else {
124 124
 			if ($this->hasOnlyCols($count)) {
125 125
 				$tmpContent=$this->content;
126 126
 				$item=$this->addItem($colsCount);
127 127
 				$item->setContent($tmpContent);
128
-				$this->content=array ();
128
+				$this->content=array();
129 129
 				$count=1;
130 130
 			}
131
-			for($i=$count; $i < $rowsCount; $i++) {
131
+			for ($i=$count; $i<$rowsCount; $i++) {
132 132
 				$this->addItem($colsCount);
133 133
 			}
134 134
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	}
137 137
 
138 138
 	protected function hasOnlyCols($count) {
139
-		return $count > 0 && $this->content[0] instanceof HtmlGridCol;
139
+		return $count>0 && $this->content[0] instanceof HtmlGridCol;
140 140
 	}
141 141
 
142 142
 	/**
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 		if (isset($width)===false) {
151 151
 			$this->setWide($numCols);
152 152
 		}
153
-		if ($toCreate === true) {
153
+		if ($toCreate===true) {
154 154
 			$count=$this->count();
155
-			if ($count == 0 || $this->hasOnlyCols($count)) {
156
-				for($i=$count; $i < $numCols; $i++) {
157
-					$this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width));
155
+			if ($count==0 || $this->hasOnlyCols($count)) {
156
+				for ($i=$count; $i<$numCols; $i++) {
157
+					$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width));
158 158
 				}
159 159
 			} else {
160
-				for($i=0; $i < $count; $i++) {
160
+				for ($i=0; $i<$count; $i++) {
161 161
 					$this->getItem($i)->setColsCount($numCols);
162 162
 				}
163 163
 			}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		$count=$this->count();
194 194
 		if ($this->hasOnlyCols($count))
195 195
 			return $count;
196
-		if ($count > 0)
196
+		if ($count>0)
197 197
 			return $this->getItem(0)->count();
198 198
 		return 0;
199 199
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
206 206
 	 */
207 207
 	public function getCell($row, $col) {
208
-		if ($row < 2 && $this->hasOnlyCols($this->count()))
208
+		if ($row<2 && $this->hasOnlyCols($this->count()))
209 209
 			return $this->getItem($col);
210 210
 		$row=$this->getItem($row);
211 211
 		if (isset($row)) {
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
221 221
 	 */
222 222
 	public function setDivided($vertically=false) {
223
-		$value=($vertically === true) ? "vertically divided" : "divided";
224
-		return $this->addToPropertyCtrl("class", $value, array ("divided" ));
223
+		$value=($vertically===true) ? "vertically divided" : "divided";
224
+		return $this->addToPropertyCtrl("class", $value, array("divided"));
225 225
 	}
226 226
 
227 227
 	/**
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
231 231
 	 */
232 232
 	public function setCelled($internally=false) {
233
-		$value=($internally === true) ? "internally celled" : "celled";
234
-		return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" ));
233
+		$value=($internally===true) ? "internally celled" : "celled";
234
+		return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled"));
235 235
 	}
236 236
 
237 237
 	/**
238 238
 	 * A grid can have its columns centered
239 239
 	 */
240 240
 	public function setCentered() {
241
-		return $this->addToPropertyCtrl("class", "centered", array ("centered" ));
241
+		return $this->addToPropertyCtrl("class", "centered", array("centered"));
242 242
 	}
243 243
 
244 244
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public function setPadded($value=NULL) {
258 258
 		if (isset($value))
259
-			$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
259
+			$this->addToPropertyCtrl("class", $value, array("vertically", "horizontally"));
260 260
 		return $this->addToProperty("class", "padded");
261 261
 	}
262 262
 
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
267 267
 	 */
268 268
 	public function setRelaxed($very=false) {
269
-		$value=($very === true) ? "very relaxed" : "relaxed";
270
-		return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" ));
269
+		$value=($very===true) ? "very relaxed" : "relaxed";
270
+		return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed"));
271 271
 	}
272 272
 
273 273
 	public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) {
274
-		return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned"));
274
+		return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned"));
275 275
 	}
276 276
 
277 277
 	/**
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
282 282
 	 */
283 283
 	protected function createItem($value) {
284
-		if ($this->_createCols === false)
284
+		if ($this->_createCols===false)
285 285
 			$value=null;
286
-		$item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows);
286
+		$item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows);
287 287
 		return $item;
288 288
 	}
289 289
 
@@ -294,15 +294,15 @@  discard block
 block discarded – undo
294 294
 	public function setValues($values, $force=true) {
295 295
 		$count=$this->count();
296 296
 		$valuesSize=\sizeof($values);
297
-		if ($this->_createCols === false || $force === true) {
298
-			for($i=$count; $i < $valuesSize; $i++) {
297
+		if ($this->_createCols===false || $force===true) {
298
+			for ($i=$count; $i<$valuesSize; $i++) {
299 299
 				$colSize=\sizeof($values[$i]);
300
-				$this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows));
300
+				$this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows));
301 301
 			}
302 302
 		}
303
-		$count=\min(array ($this->count(),$valuesSize ));
304
-		for($i=0; $i < $count; $i++) {
305
-			$this->content[$i]->setValues($values[$i], $this->_createCols === false);
303
+		$count=\min(array($this->count(), $valuesSize));
304
+		for ($i=0; $i<$count; $i++) {
305
+			$this->content[$i]->setValues($values[$i], $this->_createCols===false);
306 306
 		}
307 307
 	}
308 308
 
Please login to merge, or discard this patch.