Completed
Push — master ( eb9d7e...506112 )
by Jean-Christophe
02:56
created
Ajax/semantic/html/collections/HtmlGrid.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	}
37 37
 
38 38
 	public function asSegment() {
39
-		return $this->addToPropertyCtrl("class", "segment", array ("segment" ));
39
+		return $this->addToPropertyCtrl("class", "segment", array("segment"));
40 40
 	}
41 41
 
42 42
 	public function asContainer() {
43
-		return $this->addToPropertyCtrl("class", "container", array ("container" ));
43
+		return $this->addToPropertyCtrl("class", "container", array("container"));
44 44
 	}
45 45
 
46 46
 	/**
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param int $wide
49 49
 	 */
50 50
 	public function setWide($wide) {
51
-		if(isset(Wide::getConstants()["W" . $wide])){
52
-			$wide=Wide::getConstants()["W" . $wide];
51
+		if (isset(Wide::getConstants()["W".$wide])) {
52
+			$wide=Wide::getConstants()["W".$wide];
53 53
 			$this->addToPropertyCtrl("class", $wide, Wide::getConstants());
54
-			return $this->addToPropertyCtrl("class", "column", array ("column" ));
54
+			return $this->addToPropertyCtrl("class", "column", array("column"));
55 55
 		}
56 56
 		return $this;
57 57
 	}
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 * @return mixed
72 72
 	 */
73 73
 	public function addRow($colsCount=NULL) {
74
-		$rowCount=$this->rowCount() + 1;
74
+		$rowCount=$this->rowCount()+1;
75 75
 		$this->setRowsCount($rowCount, $colsCount, true);
76
-		return $this->content[$rowCount - 1];
76
+		return $this->content[$rowCount-1];
77 77
 	}
78 78
 
79 79
 	/**
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	 * @return mixed|\Ajax\semantic\html\collections\HtmlGrid
83 83
 	 */
84 84
 	public function addCol($width=NULL) {
85
-		$colCount=$this->colCount() + 1;
85
+		$colCount=$this->colCount()+1;
86 86
 		$this->setColsCount($colCount, true, $width);
87 87
 		if ($this->hasOnlyCols($this->count()))
88
-			return $this->content[$colCount - 1];
88
+			return $this->content[$colCount-1];
89 89
 		return $this;
90 90
 	}
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
96 96
 	 */
97 97
 	public function addCols($sizes=array()) {
98
-		foreach ( $sizes as $size ) {
98
+		foreach ($sizes as $size) {
99 99
 			$this->addCol($size);
100 100
 		}
101 101
 		return $this;
@@ -109,19 +109,19 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setRowsCount($rowsCount, $colsCount=NULL, $force=false) {
111 111
 		$count=$this->count();
112
-		if ($rowsCount < 2 && $force === false) {
113
-			for($i=$count; $i < $colsCount; $i++) {
114
-				$this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i));
112
+		if ($rowsCount<2 && $force===false) {
113
+			for ($i=$count; $i<$colsCount; $i++) {
114
+				$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i));
115 115
 			}
116 116
 		} else {
117 117
 			if ($this->hasOnlyCols($count)) {
118 118
 				$tmpContent=$this->content;
119 119
 				$item=$this->addItem($colsCount);
120 120
 				$item->setContent($tmpContent);
121
-				$this->content=array ();
121
+				$this->content=array();
122 122
 				$count=1;
123 123
 			}
124
-			for($i=$count; $i < $rowsCount; $i++) {
124
+			for ($i=$count; $i<$rowsCount; $i++) {
125 125
 				$this->addItem($colsCount);
126 126
 			}
127 127
 		}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	protected function hasOnlyCols($count) {
132
-		return $count > 0 && $this->content[0] instanceof HtmlGridCol;
132
+		return $count>0 && $this->content[0] instanceof HtmlGridCol;
133 133
 	}
134 134
 
135 135
 	/**
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 		if (isset($width)==false) {
144 144
 			$this->setWide($numCols);
145 145
 		}
146
-		if ($toCreate == true) {
146
+		if ($toCreate==true) {
147 147
 			$count=$this->count();
148
-			if ($count == 0 || $this->hasOnlyCols($count)) {
149
-				for($i=$count; $i < $numCols; $i++) {
150
-					$this->addItem(new HtmlGridCol("col-" . $this->identifier . "-" . $i, $width));
148
+			if ($count==0 || $this->hasOnlyCols($count)) {
149
+				for ($i=$count; $i<$numCols; $i++) {
150
+					$this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i, $width));
151 151
 				}
152 152
 			} else {
153
-				for($i=0; $i < $count; $i++) {
153
+				for ($i=0; $i<$count; $i++) {
154 154
 					$this->getItem($i)->setColsCount($numCols);
155 155
 				}
156 156
 			}
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		$count=$this->count();
187 187
 		if ($this->hasOnlyCols($count))
188 188
 			return $count;
189
-		if ($count > 0)
189
+		if ($count>0)
190 190
 			return $this->getItem(0)->count();
191 191
 		return 0;
192 192
 	}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @return \Ajax\semantic\html\collections\HtmlGridCol
199 199
 	 */
200 200
 	public function getCell($row, $col) {
201
-		if ($row < 2 && $this->hasOnlyCols($this->count()))
201
+		if ($row<2 && $this->hasOnlyCols($this->count()))
202 202
 			return $this->getItem($col);
203 203
 		$row=$this->getItem($row);
204 204
 		if (isset($row)) {
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
214 214
 	 */
215 215
 	public function setDivided($vertically=false) {
216
-		$value=($vertically === true) ? "vertically divided" : "divided";
217
-		return $this->addToPropertyCtrl("class", $value, array ("divided" ));
216
+		$value=($vertically===true) ? "vertically divided" : "divided";
217
+		return $this->addToPropertyCtrl("class", $value, array("divided"));
218 218
 	}
219 219
 
220 220
 	/**
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
224 224
 	 */
225 225
 	public function setCelled($internally=false) {
226
-		$value=($internally === true) ? "internally celled" : "celled";
227
-		return $this->addToPropertyCtrl("class", $value, array ("celled","internally celled" ));
226
+		$value=($internally===true) ? "internally celled" : "celled";
227
+		return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled"));
228 228
 	}
229 229
 
230 230
 	/**
231 231
 	 * A grid can have its columns centered
232 232
 	 */
233 233
 	public function setCentered() {
234
-		return $this->addToPropertyCtrl("class", "centered", array ("centered" ));
234
+		return $this->addToPropertyCtrl("class", "centered", array("centered"));
235 235
 	}
236 236
 
237 237
 	/**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function setPadded($value=NULL) {
251 251
 		if (isset($value))
252
-			$this->addToPropertyCtrl("class", $value, array ("vertically","horizontally" ));
252
+			$this->addToPropertyCtrl("class", $value, array("vertically", "horizontally"));
253 253
 		return $this->addToProperty("class", "padded");
254 254
 	}
255 255
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
 	 * @return \Ajax\semantic\html\collections\HtmlGrid
260 260
 	 */
261 261
 	public function setRelaxed($very=false) {
262
-		$value=($very === true) ? "very relaxed" : "relaxed";
263
-		return $this->addToPropertyCtrl("class", $value, array ("relaxed","very relaxed" ));
262
+		$value=($very===true) ? "very relaxed" : "relaxed";
263
+		return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed"));
264 264
 	}
265 265
 
266 266
 	public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) {
267
-		return $this->addToPropertyCtrl("class", $value . " aligned", VerticalAlignment::getConstantValues("aligned"));
267
+		return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned"));
268 268
 	}
269 269
 
270 270
 	/**
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
275 275
 	 */
276 276
 	protected function createItem($value) {
277
-		if ($this->_createCols === false)
277
+		if ($this->_createCols===false)
278 278
 			$value=null;
279
-		$item=new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $value, $this->_colSizing, $this->_implicitRows);
279
+		$item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows);
280 280
 		return $item;
281 281
 	}
282 282
 
@@ -286,15 +286,15 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	public function setValues($values, $force=true) {
288 288
 		$count=$this->count();
289
-		if ($this->_createCols === false || $force === true) {
290
-			for($i=$count; $i < \sizeof($values); $i++) {
289
+		if ($this->_createCols===false || $force===true) {
290
+			for ($i=$count; $i<\sizeof($values); $i++) {
291 291
 				$colSize=\sizeof($values[$i]);
292
-				$this->addItem(new HtmlGridRow($this->identifier . "-row-" . ($this->count() + 1), $colSize, $this->_colSizing, $this->_implicitRows));
292
+				$this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows));
293 293
 			}
294 294
 		}
295
-		$count=\min(array ($this->count(),\sizeof($values) ));
296
-		for($i=0; $i < $count; $i++) {
297
-			$this->content[$i]->setValues($values[$i], $this->_createCols === false);
295
+		$count=\min(array($this->count(), \sizeof($values)));
296
+		for ($i=0; $i<$count; $i++) {
297
+			$this->content[$i]->setValues($values[$i], $this->_createCols===false);
298 298
 		}
299 299
 	}
300 300
 
Please login to merge, or discard this patch.