Completed
Push — remove_deprecates ( 1de955 )
by Fabio
07:55
created
framework/Collections/TPagedList.php 3 patches
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -181,22 +181,18 @@  discard block
 block discarded – undo
181 181
 					$this->_currentPageIndex=$pageIndex;
182 182
 					$this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage));
183 183
 					return $pageIndex;
184
-				}
185
-				else
184
+				} else
186 185
 					return false;
187
-			}
188
-			else
186
+			} else
189 187
 				return false;
190
-		}
191
-		else
188
+		} else
192 189
 		{
193 190
 			if($pageIndex>=0 && $pageIndex<$this->getPageCount())
194 191
 			{
195 192
 				$this->_currentPageIndex=$pageIndex;
196 193
 				$this->onPageIndexChanged(null);
197 194
 				return $pageIndex;
198
-			}
199
-			else
195
+			} else
200 196
 				return false;
201 197
 		}
202 198
 	}
@@ -248,8 +244,7 @@  discard block
 block discarded – undo
248 244
 				return (int)(($this->_virtualCount+$this->_pageSize-1)/$this->_pageSize);
249 245
 			else
250 246
 				return -1;
251
-		}
252
-		else
247
+		} else
253 248
 			return (int)((parent::getCount()+$this->_pageSize-1)/$this->_pageSize);
254 249
 	}
255 250
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 	 * @param array|Iterator the initial data. Default is null, meaning no initialization.
82 82
 	 * @param boolean whether the list is read-only. Always true for paged list.
83 83
 	 */
84
-	public function __construct($data=null,$readOnly=false)
84
+	public function __construct($data=null, $readOnly=false)
85 85
 	{
86
-		parent::__construct($data,true);
86
+		parent::__construct($data, true);
87 87
 	}
88 88
 
89 89
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function setPageSize($value)
117 117
 	{
118
-		if(($value=TPropertyValue::ensureInteger($value))>0)
118
+		if(($value=TPropertyValue::ensureInteger($value)) > 0)
119 119
 			$this->_pageSize=$value;
120 120
 		else
121 121
 			throw new TInvalidDataValueException('pagedlist_pagesize_invalid');
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function onPageIndexChanged($param)
148 148
 	{
149
-		$this->raiseEvent('OnPageIndexChanged',$this,$param);
149
+		$this->raiseEvent('OnPageIndexChanged', $this, $param);
150 150
 	}
151 151
 
152 152
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function onFetchData($param)
160 160
 	{
161
-		$this->raiseEvent('OnFetchData',$this,$param);
161
+		$this->raiseEvent('OnFetchData', $this, $param);
162 162
 	}
163 163
 
164 164
 	/**
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 			return $pageIndex;
173 173
 		if($this->_customPaging)
174 174
 		{
175
-			if($pageIndex>=0 && ($this->_virtualCount<0 || $pageIndex<$this->getPageCount()))
175
+			if($pageIndex >= 0 && ($this->_virtualCount < 0 || $pageIndex < $this->getPageCount()))
176 176
 			{
177
-				$param=new TPagedListFetchDataEventParameter($pageIndex,$this->_pageSize*$pageIndex,$this->_pageSize);
177
+				$param=new TPagedListFetchDataEventParameter($pageIndex, $this->_pageSize * $pageIndex, $this->_pageSize);
178 178
 				$this->onFetchData($param);
179 179
 				if(($data=$param->getData())!==null)
180 180
 				{
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 		else
196 196
 		{
197
-			if($pageIndex>=0 && $pageIndex<$this->getPageCount())
197
+			if($pageIndex >= 0 && $pageIndex < $this->getPageCount())
198 198
 			{
199 199
 				$this->_currentPageIndex=$pageIndex;
200 200
 				$this->onPageIndexChanged(null);
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	public function nextPage()
213 213
 	{
214
-		return $this->gotoPage($this->_currentPageIndex+1);
214
+		return $this->gotoPage($this->_currentPageIndex + 1);
215 215
 	}
216 216
 
217 217
 	/**
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	public function previousPage()
222 222
 	{
223
-		return $this->gotoPage($this->_currentPageIndex-1);
223
+		return $this->gotoPage($this->_currentPageIndex - 1);
224 224
 	}
225 225
 
226 226
 	/**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function setVirtualCount($value)
238 238
 	{
239
-		if(($value=TPropertyValue::ensureInteger($value))<0)
239
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
240 240
 			$value=-1;
241 241
 		$this->_virtualCount=$value;
242 242
 	}
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
 	{
249 249
 		if($this->_customPaging)
250 250
 		{
251
-			if($this->_virtualCount>=0)
252
-				return (int)(($this->_virtualCount+$this->_pageSize-1)/$this->_pageSize);
251
+			if($this->_virtualCount >= 0)
252
+				return (int) (($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize);
253 253
 			else
254 254
 				return -1;
255 255
 		}
256 256
 		else
257
-			return (int)((parent::getCount()+$this->_pageSize-1)/$this->_pageSize);
257
+			return (int) ((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize);
258 258
 	}
259 259
 
260 260
 	/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public function getIsLastPage()
272 272
 	{
273
-		return $this->_currentPageIndex===$this->getPageCount()-1;
273
+		return $this->_currentPageIndex===$this->getPageCount() - 1;
274 274
 	}
275 275
 
276 276
 	/**
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 			return parent::getCount();
283 283
 		else
284 284
 		{
285
-			if($this->_currentPageIndex===$this->getPageCount()-1)
286
-				return parent::getCount()-$this->_pageSize*$this->_currentPageIndex;
285
+			if($this->_currentPageIndex===$this->getPageCount() - 1)
286
+				return parent::getCount() - $this->_pageSize * $this->_currentPageIndex;
287 287
 			else
288 288
 				return $this->_pageSize;
289 289
 		}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 		if($this->_customPaging)
316 316
 			return parent::itemAt($index);
317 317
 		else
318
-			return parent::itemAt($this->_pageSize*$this->_currentPageIndex+$index);
318
+			return parent::itemAt($this->_pageSize * $this->_currentPageIndex + $index);
319 319
 	}
320 320
 
321 321
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	public function indexOf($item)
326 326
 	{
327 327
 		$c=$this->getCount();
328
-		for($i=0;$i<$c;++$i)
328
+		for($i=0; $i < $c; ++$i)
329 329
 			if($this->itemAt($i)===$item)
330 330
 				return $i;
331 331
 		return -1;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 */
340 340
 	public function offsetExists($offset)
341 341
 	{
342
-		return ($offset>=0 && $offset<$this->getCount());
342
+		return ($offset >= 0 && $offset < $this->getCount());
343 343
 	}
344 344
 
345 345
 	/**
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	{
362 362
 		$c=$this->getCount();
363 363
 		$array=array();
364
-		for($i=0;$i<$c;++$i)
364
+		for($i=0; $i < $c; ++$i)
365 365
 			$array[$i]=$this->itemAt($i);
366 366
 		return $array;
367 367
 	}
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,6 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 	/**
98 98
 	 * @param boolean whether to allow custom paging
99
+	 * @param boolean $value
99 100
 	 */
100 101
 	public function setCustomPaging($value)
101 102
 	{
@@ -143,6 +144,7 @@  discard block
 block discarded – undo
143 144
 	 * Raises <b>OnPageIndexChanged</b> event.
144 145
 	 * This event is raised each time when the list changes to a different page.
145 146
 	 * @param TPagedListPageChangedEventParameter event parameter
147
+	 * @param TPagedListPageChangedEventParameter|null $param
146 148
 	 */
147 149
 	public function onPageIndexChanged($param)
148 150
 	{
@@ -155,6 +157,7 @@  discard block
 block discarded – undo
155 157
 	 * and needs the new page of data. This event can only be raised when
156 158
 	 * {@link setCustomPaging CustomPaging} is true.
157 159
 	 * @param TPagedListFetchDataEventParameter event parameter
160
+	 * @param TPagedListFetchDataEventParameter $param
158 161
 	 */
159 162
 	public function onFetchData($param)
160 163
 	{
@@ -290,7 +293,7 @@  discard block
 block discarded – undo
290 293
 	}
291 294
 
292 295
 	/**
293
-	 * @return Iterator iterator
296
+	 * @return \ArrayIterator iterator
294 297
 	 */
295 298
 	public function getIterator()
296 299
 	{
Please login to merge, or discard this patch.
framework/Collections/TMap.php 3 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -163,11 +163,9 @@  discard block
 block discarded – undo
163 163
 				$value=$this->_d[$key];
164 164
 				unset($this->_d[$key]);
165 165
 				return $value;
166
-			}
167
-			else
166
+			} else
168 167
 				return null;
169
-		}
170
-		else
168
+		} else
171 169
 			throw new TInvalidOperationException('map_readonly',get_class($this));
172 170
 	}
173 171
 
@@ -211,8 +209,7 @@  discard block
 block discarded – undo
211 209
 				$this->clear();
212 210
 			foreach($data as $key=>$value)
213 211
 				$this->add($key,$value);
214
-		}
215
-		else if($data!==null)
212
+		} else if($data!==null)
216 213
 			throw new TInvalidDataTypeException('map_data_not_iterable');
217 214
 	}
218 215
 
@@ -228,8 +225,7 @@  discard block
 block discarded – undo
228 225
 		{
229 226
 			foreach($data as $key=>$value)
230 227
 				$this->add($key,$value);
231
-		}
232
-		else if($data!==null)
228
+		} else if($data!==null)
233 229
 			throw new TInvalidDataTypeException('map_data_not_iterable');
234 230
 	}
235 231
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,6 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
 	/**
88 88
 	 * @param boolean whether this list is read-only or not
89
+	 * @param boolean $value
89 90
 	 */
90 91
 	protected function setReadOnly($value)
91 92
 	{
@@ -95,7 +96,7 @@  discard block
 block discarded – undo
95 96
 	/**
96 97
 	 * Returns an iterator for traversing the items in the list.
97 98
 	 * This method is required by the interface \IteratorAggregate.
98
-	 * @return Iterator an iterator for traversing the items in the list.
99
+	 * @return \ArrayIterator an iterator for traversing the items in the list.
99 100
 	 */
100 101
 	public function getIterator()
101 102
 	{
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
 	protected function _getZappableSleepProps(&$exprops)
57 57
 	{
58 58
 		parent::_getZappableSleepProps($exprops);
59
-		if ($this->_d===array())
60
-			$exprops[] = "\0Prado\Collections\TMap\0_d";
61
-		if ($this->_r===false)
62
-			$exprops[] = "\0Prado\Collections\TMap\0_r";
59
+		if($this->_d===array())
60
+			$exprops[]="\0Prado\Collections\TMap\0_d";
61
+		if($this->_r===false)
62
+			$exprops[]="\0Prado\Collections\TMap\0_r";
63 63
 	}
64 64
 
65 65
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param boolean whether the list is read-only
70 70
 	 * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator.
71 71
 	 */
72
-	public function __construct($data=null,$readOnly=false)
72
+	public function __construct($data=null, $readOnly=false)
73 73
 	{
74 74
 		if($data!==null)
75 75
 			$this->copyFrom($data);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function getIterator()
101 101
 	{
102
-		return new \ArrayIterator( $this->_d );
102
+		return new \ArrayIterator($this->_d);
103 103
 	}
104 104
 
105 105
 	/**
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 	 * @param mixed value
147 147
 	 * @throws TInvalidOperationException if the map is read-only
148 148
 	 */
149
-	public function add($key,$value)
149
+	public function add($key, $value)
150 150
 	{
151 151
 		if(!$this->_r)
152 152
 			$this->_d[$key]=$value;
153 153
 		else
154
-			throw new TInvalidOperationException('map_readonly',get_class($this));
154
+			throw new TInvalidOperationException('map_readonly', get_class($this));
155 155
 	}
156 156
 
157 157
 	/**
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	{
165 165
 		if(!$this->_r)
166 166
 		{
167
-			if(isset($this->_d[$key]) || array_key_exists($key,$this->_d))
167
+			if(isset($this->_d[$key]) || array_key_exists($key, $this->_d))
168 168
 			{
169 169
 				$value=$this->_d[$key];
170 170
 				unset($this->_d[$key]);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				return null;
175 175
 		}
176 176
 		else
177
-			throw new TInvalidOperationException('map_readonly',get_class($this));
177
+			throw new TInvalidOperationException('map_readonly', get_class($this));
178 178
 	}
179 179
 
180 180
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function contains($key)
194 194
 	{
195
-		return isset($this->_d[$key]) || array_key_exists($key,$this->_d);
195
+		return isset($this->_d[$key]) || array_key_exists($key, $this->_d);
196 196
 	}
197 197
 
198 198
 	/**
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
 	{
214 214
 		if(is_array($data) || $data instanceof Traversable)
215 215
 		{
216
-			if($this->getCount()>0)
216
+			if($this->getCount() > 0)
217 217
 				$this->clear();
218 218
 			foreach($data as $key=>$value)
219
-				$this->add($key,$value);
219
+				$this->add($key, $value);
220 220
 		}
221 221
 		else if($data!==null)
222 222
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 		if(is_array($data) || $data instanceof Traversable)
234 234
 		{
235 235
 			foreach($data as $key=>$value)
236
-				$this->add($key,$value);
236
+				$this->add($key, $value);
237 237
 		}
238 238
 		else if($data!==null)
239 239
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 	 * @param integer the offset to set element
268 268
 	 * @param mixed the element value
269 269
 	 */
270
-	public function offsetSet($offset,$item)
270
+	public function offsetSet($offset, $item)
271 271
 	{
272
-		$this->add($offset,$item);
272
+		$this->add($offset, $item);
273 273
 	}
274 274
 
275 275
 	/**
Please login to merge, or discard this patch.
framework/Collections/TList.php 3 patches
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -155,11 +155,9 @@  discard block
 block discarded – undo
155 155
 			{
156 156
 				array_splice($this->_d,$index,0,array($item));
157 157
 				$this->_c++;
158
-			}
159
-			else
158
+			} else
160 159
 				throw new TInvalidDataValueException('list_index_invalid',$index);
161
-		}
162
-		else
160
+		} else
163 161
 			throw new TInvalidOperationException('list_readonly',get_class($this));
164 162
 	}
165 163
 
@@ -180,11 +178,9 @@  discard block
 block discarded – undo
180 178
 			{
181 179
 				$this->removeAt($index);
182 180
 				return $index;
183
-			}
184
-			else
181
+			} else
185 182
 				throw new TInvalidDataValueException('list_item_inexistent');
186
-		}
187
-		else
183
+		} else
188 184
 			throw new TInvalidOperationException('list_readonly',get_class($this));
189 185
 	}
190 186
 
@@ -210,11 +206,9 @@  discard block
 block discarded – undo
210 206
 					array_splice($this->_d,$index,1);
211 207
 					return $item;
212 208
 				}
213
-			}
214
-			else
209
+			} else
215 210
 				throw new TInvalidDataValueException('list_index_invalid',$index);
216
-		}
217
-		else
211
+		} else
218 212
 			throw new TInvalidOperationException('list_readonly',get_class($this));
219 213
 	}
220 214
 
@@ -268,8 +262,7 @@  discard block
 block discarded – undo
268 262
 			$this->insertAt($index, $item);
269 263
 
270 264
 			return $index;
271
-		}
272
-		else
265
+		} else
273 266
 			throw new TInvalidOperationException('list_readonly',get_class($this));
274 267
 	}
275 268
 
@@ -292,8 +285,7 @@  discard block
 block discarded – undo
292 285
 			$this->insertAt($index + 1, $item);
293 286
 
294 287
 			return $index + 1;
295
-		}
296
-		else
288
+		} else
297 289
 			throw new TInvalidOperationException('list_readonly',get_class($this));
298 290
 	}
299 291
 
@@ -319,8 +311,7 @@  discard block
 block discarded – undo
319 311
 				$this->clear();
320 312
 			foreach($data as $item)
321 313
 				$this->add($item);
322
-		}
323
-		else if($data!==null)
314
+		} else if($data!==null)
324 315
 			throw new TInvalidDataTypeException('list_data_not_iterable');
325 316
 	}
326 317
 
@@ -336,8 +327,7 @@  discard block
 block discarded – undo
336 327
 		{
337 328
 			foreach($data as $item)
338 329
 				$this->add($item);
339
-		}
340
-		else if($data!==null)
330
+		} else if($data!==null)
341 331
 			throw new TInvalidDataTypeException('list_data_not_iterable');
342 332
 	}
343 333
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,6 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 	/**
83 83
 	 * @param boolean whether this list is read-only or not
84
+	 * @param boolean $value
84 85
 	 */
85 86
 	protected function setReadOnly($value)
86 87
 	{
@@ -90,7 +91,7 @@  discard block
 block discarded – undo
90 91
 	/**
91 92
 	 * Returns an iterator for traversing the items in the list.
92 93
 	 * This method is required by the interface \IteratorAggregate.
93
-	 * @return Iterator an iterator for traversing the items in the list.
94
+	 * @return \ArrayIterator an iterator for traversing the items in the list.
94 95
 	 */
95 96
 	public function getIterator()
96 97
 	{
@@ -283,7 +284,7 @@  discard block
 block discarded – undo
283 284
 	 * Finds the base item.  If found, the item is inserted after it.
284 285
 	 * @param mixed the base item which comes before the second parameter when added to the list
285 286
 	 * @param mixed the item
286
-	 * @return int the index where the item is inserted
287
+	 * @return double the index where the item is inserted
287 288
 	 * @throws TInvalidDataValueException if the base item is not within this list
288 289
 	 * @throws TInvalidOperationException if the list is read-only
289 290
 	 * @since 3.2a
@@ -334,6 +335,7 @@  discard block
 block discarded – undo
334 335
 	 * Merges iterable data into the map.
335 336
 	 * New data will be appended to the end of the existing data.
336 337
 	 * @param mixed the data to be merged with, must be an array or object implementing Traversable
338
+	 * @param \Prado\Web\UI\WebControls\TDataGridColumnCollection|null $data
337 339
 	 * @throws TInvalidDataTypeException If data is neither an array nor an iterator.
338 340
 	 */
339 341
 	public function mergeWith($data)
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @param boolean whether the list is read-only
65 65
 	 * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator.
66 66
 	 */
67
-	public function __construct($data=null,$readOnly=false)
67
+	public function __construct($data=null, $readOnly=false)
68 68
 	{
69 69
 		if($data!==null)
70 70
 			$this->copyFrom($data);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getIterator()
96 96
 	{
97
-		return new \ArrayIterator( $this->_d );
97
+		return new \ArrayIterator($this->_d);
98 98
 	}
99 99
 
100 100
 	/**
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function itemAt($index)
126 126
 	{
127
-		if($index>=0 && $index<$this->_c)
127
+		if($index >= 0 && $index < $this->_c)
128 128
 			return $this->_d[$index];
129 129
 		else
130
-			throw new TInvalidDataValueException('list_index_invalid',$index);
130
+			throw new TInvalidDataValueException('list_index_invalid', $index);
131 131
 	}
132 132
 
133 133
 	/**
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function add($item)
140 140
 	{
141
-		$this->insertAt($this->_c,$item);
142
-		return $this->_c-1;
141
+		$this->insertAt($this->_c, $item);
142
+		return $this->_c - 1;
143 143
 	}
144 144
 
145 145
 	/**
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
 	 * @throws TInvalidDataValueException If the index specified exceeds the bound
152 152
 	 * @throws TInvalidOperationException if the list is read-only
153 153
 	 */
154
-	public function insertAt($index,$item)
154
+	public function insertAt($index, $item)
155 155
 	{
156 156
 		if(!$this->_r)
157 157
 		{
158 158
 			if($index===$this->_c)
159 159
 				$this->_d[$this->_c++]=$item;
160
-			else if($index>=0 && $index<$this->_c)
160
+			else if($index >= 0 && $index < $this->_c)
161 161
 			{
162
-				array_splice($this->_d,$index,0,array($item));
162
+				array_splice($this->_d, $index, 0, array($item));
163 163
 				$this->_c++;
164 164
 			}
165 165
 			else
166
-				throw new TInvalidDataValueException('list_index_invalid',$index);
166
+				throw new TInvalidDataValueException('list_index_invalid', $index);
167 167
 		}
168 168
 		else
169
-			throw new TInvalidOperationException('list_readonly',get_class($this));
169
+			throw new TInvalidOperationException('list_readonly', get_class($this));
170 170
 	}
171 171
 
172 172
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	{
183 183
 		if(!$this->_r)
184 184
 		{
185
-			if(($index=$this->indexOf($item))>=0)
185
+			if(($index=$this->indexOf($item)) >= 0)
186 186
 			{
187 187
 				$this->removeAt($index);
188 188
 				return $index;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				throw new TInvalidDataValueException('list_item_inexistent');
192 192
 		}
193 193
 		else
194
-			throw new TInvalidOperationException('list_readonly',get_class($this));
194
+			throw new TInvalidOperationException('list_readonly', get_class($this));
195 195
 	}
196 196
 
197 197
 	/**
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	{
206 206
 		if(!$this->_r)
207 207
 		{
208
-			if($index>=0 && $index<$this->_c)
208
+			if($index >= 0 && $index < $this->_c)
209 209
 			{
210 210
 				$this->_c--;
211 211
 				if($index===$this->_c)
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 				else
214 214
 				{
215 215
 					$item=$this->_d[$index];
216
-					array_splice($this->_d,$index,1);
216
+					array_splice($this->_d, $index, 1);
217 217
 					return $item;
218 218
 				}
219 219
 			}
220 220
 			else
221
-				throw new TInvalidDataValueException('list_index_invalid',$index);
221
+				throw new TInvalidDataValueException('list_index_invalid', $index);
222 222
 		}
223 223
 		else
224
-			throw new TInvalidOperationException('list_readonly',get_class($this));
224
+			throw new TInvalidOperationException('list_readonly', get_class($this));
225 225
 	}
226 226
 
227 227
 	/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	public function clear()
232 232
 	{
233
-		for($i=$this->_c-1;$i>=0;--$i)
233
+		for($i=$this->_c - 1; $i >= 0; --$i)
234 234
 			$this->removeAt($i);
235 235
 	}
236 236
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function contains($item)
242 242
 	{
243
-		return $this->indexOf($item)>=0;
243
+		return $this->indexOf($item) >= 0;
244 244
 	}
245 245
 
246 246
 	/**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	public function indexOf($item)
251 251
 	{
252
-		if(($index=array_search($item,$this->_d,true))===false)
252
+		if(($index=array_search($item, $this->_d, true))===false)
253 253
 			return -1;
254 254
 		else
255 255
 			return $index;
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	{
269 269
 		if(!$this->_r)
270 270
 		{
271
-			if(($index = $this->indexOf($baseitem)) == -1)
271
+			if(($index=$this->indexOf($baseitem))==-1)
272 272
 				throw new TInvalidDataValueException('list_item_inexistent');
273 273
 
274 274
 			$this->insertAt($index, $item);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			return $index;
277 277
 		}
278 278
 		else
279
-			throw new TInvalidOperationException('list_readonly',get_class($this));
279
+			throw new TInvalidOperationException('list_readonly', get_class($this));
280 280
 	}
281 281
 
282 282
 	/**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	{
293 293
 		if(!$this->_r)
294 294
 		{
295
-			if(($index = $this->indexOf($baseitem)) == -1)
295
+			if(($index=$this->indexOf($baseitem))==-1)
296 296
 				throw new TInvalidDataValueException('list_item_inexistent');
297 297
 
298 298
 			$this->insertAt($index + 1, $item);
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			return $index + 1;
301 301
 		}
302 302
 		else
303
-			throw new TInvalidOperationException('list_readonly',get_class($this));
303
+			throw new TInvalidOperationException('list_readonly', get_class($this));
304 304
 	}
305 305
 
306 306
 	/**
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	{
322 322
 		if(is_array($data) || ($data instanceof \Traversable))
323 323
 		{
324
-			if($this->_c>0)
324
+			if($this->_c > 0)
325 325
 				$this->clear();
326 326
 			foreach($data as $item)
327 327
 				$this->add($item);
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	public function offsetExists($offset)
357 357
 	{
358
-		return ($offset>=0 && $offset<$this->_c);
358
+		return ($offset >= 0 && $offset < $this->_c);
359 359
 	}
360 360
 
361 361
 	/**
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 	 * @param integer the offset to set item
377 377
 	 * @param mixed the item value
378 378
 	 */
379
-	public function offsetSet($offset,$item)
379
+	public function offsetSet($offset, $item)
380 380
 	{
381 381
 		if($offset===null || $offset===$this->_c)
382
-			$this->insertAt($this->_c,$item);
382
+			$this->insertAt($this->_c, $item);
383 383
 		else
384 384
 		{
385 385
 			$this->removeAt($offset);
386
-			$this->insertAt($offset,$item);
386
+			$this->insertAt($offset, $item);
387 387
 		}
388 388
 	}
389 389
 
Please login to merge, or discard this patch.
framework/Collections/TListItemCollection.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 	public function createListItem($index=-1)
39 39
 	{
40 40
 		$item=$this->createNewListItem();
41
-		if($index<0)
41
+		if($index < 0)
42 42
 			$this->add($item);
43 43
 		else
44
-			$this->insertAt($index,$item);
44
+			$this->insertAt($index, $item);
45 45
 		return $item;
46 46
 	}
47 47
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	protected function createNewListItem($text=null)
52 52
 	{
53
-		$item =  new TListItem;
53
+		$item=new TListItem;
54 54
 		if($text!==null)
55 55
 			$item->setText($text);
56 56
 		return $item;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 * @param TListItem the item to be inserted.
64 64
 	 * @throws TInvalidDataTypeException if the item being inserted is neither a string nor TListItem
65 65
 	 */
66
-	public function insertAt($index,$item)
66
+	public function insertAt($index, $item)
67 67
 	{
68 68
 		if(is_string($item))
69
-			$item = $this->createNewListItem($item);
69
+			$item=$this->createNewListItem($item);
70 70
 		if(!($item instanceof TListItem))
71
-			throw new TInvalidDataTypeException('listitemcollection_item_invalid',get_class($this));
72
-		parent::insertAt($index,$item);
71
+			throw new TInvalidDataTypeException('listitemcollection_item_invalid', get_class($this));
72
+		parent::insertAt($index, $item);
73 73
 	}
74 74
 
75 75
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @param boolean whether to look for disabled items also
79 79
 	 * @return integer the index of the item found, -1 if not found.
80 80
 	 */
81
-	public function findIndexByValue($value,$includeDisabled=true)
81
+	public function findIndexByValue($value, $includeDisabled=true)
82 82
 	{
83 83
 		$value=TPropertyValue::ensureString($value);
84 84
 		$index=0;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 * @param boolean whether to look for disabled items also
98 98
 	 * @return integer the index of the item found, -1 if not found.
99 99
 	 */
100
-	public function findIndexByText($text,$includeDisabled=true)
100
+	public function findIndexByText($text, $includeDisabled=true)
101 101
 	{
102 102
 		$text=TPropertyValue::ensureString($text);
103 103
 		$index=0;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 * @param boolean whether to look for disabled items also
117 117
 	 * @return TListItem the item found, null if not found.
118 118
 	 */
119
-	public function findItemByValue($value,$includeDisabled=true)
119
+	public function findItemByValue($value, $includeDisabled=true)
120 120
 	{
121
-		if(($index=$this->findIndexByValue($value,$includeDisabled))>=0)
121
+		if(($index=$this->findIndexByValue($value, $includeDisabled)) >= 0)
122 122
 			return $this->itemAt($index);
123 123
 		else
124 124
 			return null;
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param boolean whether to look for disabled items also
131 131
 	 * @return TListItem the item found, null if not found.
132 132
 	 */
133
-	public function findItemByText($text,$includeDisabled=true)
133
+	public function findItemByText($text, $includeDisabled=true)
134 134
 	{
135
-		if(($index=$this->findIndexByText($text,$includeDisabled))>=0)
135
+		if(($index=$this->findIndexByText($text, $includeDisabled)) >= 0)
136 136
 			return $this->itemAt($index);
137 137
 		else
138 138
 			return null;
@@ -157,6 +157,6 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function saveState()
159 159
 	{
160
-		return ($this->getCount()>0) ? $this->toArray() : null;
160
+		return ($this->getCount() > 0) ? $this->toArray() : null;
161 161
 	}
162 162
 }
Please login to merge, or discard this patch.
framework/TApplicationComponent.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
 	 * @param string name of the class whose containing directory will be prepend to the asset path. If null, it means get_class($this).
95 95
 	 * @return string URL to the asset path.
96 96
 	 */
97
-	public function publishAsset($assetPath,$className=null)
97
+	public function publishAsset($assetPath, $className=null)
98 98
 	{
99 99
 		if($className===null)
100 100
 			$className=get_class($this);
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	}
52 52
 
53 53
 	/**
54
-	 * @return THttpRequest the current user request
54
+	 * @return Web\THttpRequest the current user request
55 55
 	 */
56 56
 	public function getRequest()
57 57
 	{
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	/**
62
-	 * @return THttpResponse the response
62
+	 * @return Web\THttpResponse the response
63 63
 	 */
64 64
 	public function getResponse()
65 65
 	{
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	/**
70
-	 * @return THttpSession user session
70
+	 * @return Web\THttpSession user session
71 71
 	 */
72 72
 	public function getSession()
73 73
 	{
@@ -94,6 +94,7 @@  discard block
 block discarded – undo
94 94
 	 *
95 95
 	 * @param string path of the asset that is relative to the directory containing the specified class file.
96 96
 	 * @param string name of the class whose containing directory will be prepend to the asset path. If null, it means get_class($this).
97
+	 * @param string $assetPath
97 98
 	 * @return string URL to the asset path.
98 99
 	 */
99 100
 	public function publishAsset($assetPath,$className=null)
@@ -108,6 +109,7 @@  discard block
 block discarded – undo
108 109
 	/**
109 110
 	 * Publishes a file or directory and returns its URL.
110 111
 	 * @param string absolute path of the file or directory to be published
112
+	 * @param string $fullPath
111 113
 	 * @return string URL to the published file or directory
112 114
 	 */
113 115
 	public function publishFilePath($fullPath, $checkTimestamp=false)
Please login to merge, or discard this patch.
framework/Security/IUserManager.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
 	 * @param string password
52 52
 	 * @return boolean true if validation is successful, false otherwise.
53 53
 	 */
54
-	public function validateUser($username,$password);
54
+	public function validateUser($username, $password);
55 55
 }
56 56
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -37,6 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * Returns a user instance according to auth data stored in a cookie.
39 39
 	 * @param THttpCookie the cookie storing user authentication information
40
+	 * @param \Prado\Web\THttpCookie $cookie
40 41
 	 * @return TUser the user instance generated based on the cookie auth data, null if the cookie does not have valid auth data.
41 42
 	 * @since 3.1.1
42 43
 	 */
@@ -44,7 +45,9 @@  discard block
 block discarded – undo
44 45
 	/**
45 46
 	 * Saves user auth data into a cookie.
46 47
 	 * @param THttpCookie the cookie to receive the user auth data.
48
+	 * @param \Prado\Web\THttpCookie $cookie
47 49
 	 * @since 3.1.1
50
+	 * @return void
48 51
 	 */
49 52
 	public function saveUserToCookie($cookie);
50 53
 	/**
Please login to merge, or discard this patch.
framework/I18N/TTranslateParameter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * To trim or not to trim the contents.
51 51
 	 * @var boolean
52 52
 	 */
53
-	protected $trim = true;
53
+	protected $trim=true;
54 54
 
55 55
 
56 56
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function setKey($value)
72 72
 	{
73
-		$this->key = $value;
73
+		$this->key=$value;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function setTrim($value)
81 81
 	{
82
-		$this->trim = TPropertyValue::ensureBoolean($value);
82
+		$this->trim=TPropertyValue::ensureBoolean($value);
83 83
 	}
84 84
 
85 85
 	/**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function getParameter()
108 108
 	{
109
-		$value = $this->getValue();
109
+		$value=$this->getValue();
110 110
 		if(strlen($value) > 0)
111 111
 			return $value;
112
-		$htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
112
+		$htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
113 113
 		$this->renderControl($htmlWriter);
114 114
 		return $this->getTrim() ?
115 115
 			trim($htmlWriter->flush()) : $htmlWriter->flush();
Please login to merge, or discard this patch.
framework/I18N/core/MessageFormat.php 3 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -63,25 +63,25 @@  discard block
 block discarded – undo
63 63
 	 * A list of loaded message catalogues.
64 64
 	 * @var array 
65 65
 	 */
66
-	protected $catagloues = array();
66
+	protected $catagloues=array();
67 67
 	
68 68
 	/**
69 69
 	 * The translation messages.
70 70
 	 * @var array 
71 71
 	 */
72
-	protected $messages = array();
72
+	protected $messages=array();
73 73
 	
74 74
 	/**
75 75
 	 * A list of untranslated messages.
76 76
 	 * @var array 
77 77
 	 */
78
-	protected $untranslated = array();
78
+	protected $untranslated=array();
79 79
 	
80 80
 	/**
81 81
 	 * The prefix and suffix to append to untranslated messages.
82 82
 	 * @var array 
83 83
 	 */
84
-	protected $postscript = array('','');
84
+	protected $postscript=array('', '');
85 85
 	
86 86
 	/**
87 87
 	 * Set the default catalogue.
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * Output encoding charset
94 94
 	 * @var string
95 95
 	 */
96
-	protected $charset = 'UTF-8'; 
96
+	protected $charset='UTF-8'; 
97 97
 
98 98
 	/**
99 99
 	 * Constructor.
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	function __construct(IMessageSource $source, $charset='UTF-8')
106 106
 	{
107
-		$this->source = $source;	
107
+		$this->source=$source;	
108 108
 		$this->setCharset($charset);
109 109
 	}
110 110
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function setCharset($charset)
116 116
 	{
117
-		$this->charset = $charset;
117
+		$this->charset=$charset;
118 118
 	}
119 119
 
120 120
 	/**
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function loadCatalogue($catalogue)
137 137
 	{
138
-		if(in_array($catalogue,$this->catagloues))
138
+		if(in_array($catalogue, $this->catagloues))
139 139
 			return;
140 140
 			
141 141
 		if($this->source->load($catalogue))
142 142
 		{
143
-			$this->messages[$catalogue] = $this->source->read();
144
-			$this->catagloues[] = $catalogue;						
143
+			$this->messages[$catalogue]=$this->source->read();
144
+			$this->catagloues[]=$catalogue;						
145 145
 		}
146 146
 	}
147 147
 
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 	 * catalogue.
159 159
 	 * @return string translated string.
160 160
 	 */
161
-	public function format($string,$args=array(), $catalogue=null, $charset=null) 
161
+	public function format($string, $args=array(), $catalogue=null, $charset=null) 
162 162
 	{
163
-		if(empty($charset)) $charset = $this->getCharset();
163
+		if(empty($charset)) $charset=$this->getCharset();
164 164
 		
165 165
 		//force args as UTF-8
166 166
 		foreach($args as $k => $v)
167
-			$args[$k] = I18N_toUTF8($v, $charset);
168
-		$s = $this->formatString(I18N_toUTF8($string, $charset),$args,$catalogue);
167
+			$args[$k]=I18N_toUTF8($v, $charset);
168
+		$s=$this->formatString(I18N_toUTF8($string, $charset), $args, $catalogue);
169 169
 		return I18N_toEncoding($s, $charset);
170 170
 	}
171 171
 
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 		if(empty($catalogue))
183 183
 		{
184 184
 			if(empty($this->Catalogue))
185
-				$catalogue = 'messages';
185
+				$catalogue='messages';
186 186
 			else 
187
-				$catalogue = $this->Catalogue;
187
+				$catalogue=$this->Catalogue;
188 188
 		}
189 189
 				
190 190
 		$this->loadCatalogue($catalogue);
191 191
 		
192 192
 		if(empty($args))
193
-			$args = array();		
193
+			$args=array();		
194 194
 		
195 195
 		foreach($this->messages[$catalogue] as $variant)
196 196
 		{
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 			foreach($variant as $source => $result)
199 199
 			{ 
200 200
 				// we found it, so return the target translation
201
-				if($source == $string)
201
+				if($source==$string)
202 202
 				{
203 203
 					//check if it contains only strings.
204 204
 					if(is_string($result))
205
-						$target = $result;
205
+						$target=$result;
206 206
 					else
207 207
 					{
208
-						$target = $result[0];
208
+						$target=$result[0];
209 209
 					}
210 210
 					//found, but untranslated
211 211
 					if(empty($target))
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 	 */
246 246
 	function setUntranslatedPS($postscript)
247 247
 	{
248
-		if(is_array($postscript) && count($postscript)>=2)
248
+		if(is_array($postscript) && count($postscript) >= 2)
249 249
 		{
250
-			$this->postscript[0] = $postscript[0];
251
-			$this->postscript[1] = $postscript[1];
250
+			$this->postscript[0]=$postscript[0];
251
+			$this->postscript[1]=$postscript[1];
252 252
 		}
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -213,8 +213,7 @@
 block discarded – undo
213 213
 						return 	$this->postscript[0].
214 214
 								strtr($string, $args).
215 215
 								$this->postscript[1];		
216
-					}
217
-					else
216
+					} else
218 217
 						return strtr($target, $args);
219 218
 				}
220 219
 			}
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -111,6 +111,7 @@
 block discarded – undo
111 111
 	/** 
112 112
 	 * Sets the charset for message output.
113 113
 	 * @param string charset, default is UTF-8
114
+	 * @param string $charset
114 115
 	 */
115 116
 	public function setCharset($charset)
116 117
 	{
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource_Database.php 3 patches
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	function __construct($source)
43 43
 	{
44
-		$this->_connID= (string)$source;
44
+		$this->_connID=(string) $source;
45 45
 	}
46 46
 
47 47
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			if($conn instanceof TDataSourceConfig)
72 72
 				return $conn->getDbConnection();
73 73
 			else
74
-				throw new TConfigurationException('messagesource_connectionid_invalid',$connectionID);
74
+				throw new TConfigurationException('messagesource_connectionid_invalid', $connectionID);
75 75
 		}
76 76
 		else
77 77
 			throw new TConfigurationException('messagesource_connectionid_required');
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 				WHERE c.cat_id =  t.cat_id
92 92
 					AND c.name = :variant
93 93
 				ORDER BY id ASC');
94
-		$command->bindParameter(':variant',$variant,PDO::PARAM_STR);
94
+		$command->bindParameter(':variant', $variant, PDO::PARAM_STR);
95 95
 		$dataReader=$command->query();
96 96
 
97
-		$result = array();
97
+		$result=array();
98 98
 
99
-		foreach ($dataReader as $row)
100
-			$result[$row['source']] = array($row['target'],$row['id'],$row['comments']);
99
+		foreach($dataReader as $row)
100
+			$result[$row['source']]=array($row['target'], $row['id'], $row['comments']);
101 101
 
102 102
 		return $result;
103 103
 	}
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	{
113 113
 		$command=$this->getDBConnection()->createCommand(
114 114
 			'SELECT date_modified FROM catalogue WHERE name = :source');
115
-		$command->bindParameter(':source',$source,PDO::PARAM_STR);
115
+		$command->bindParameter(':source', $source, PDO::PARAM_STR);
116 116
 		$result=$command->queryScalar();
117 117
 		return $result ? $result : 0;
118 118
 	}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	{
129 129
 		$command=$this->getDBConnection()->createCommand(
130 130
 			'SELECT COUNT(*) FROM catalogue WHERE name = :variant');
131
-		$command->bindParameter(':variant',$variant,PDO::PARAM_STR);
131
+		$command->bindParameter(':variant', $variant, PDO::PARAM_STR);
132 132
 		return $command->queryScalar()==1;
133 133
 	}
134 134
 
@@ -139,18 +139,18 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function getCatalogueList($catalogue)
141 141
 	{
142
-		$variants = explode('_',$this->culture);
142
+		$variants=explode('_', $this->culture);
143 143
 
144
-		$catalogues = array($catalogue);
144
+		$catalogues=array($catalogue);
145 145
 
146
-		$variant = null;
146
+		$variant=null;
147 147
 
148
-		for($i = 0, $k = count($variants); $i < $k; ++$i)
148
+		for($i=0, $k=count($variants); $i < $k; ++$i)
149 149
 		{
150 150
 			if(isset($variants[$i]{0}))
151 151
 			{
152
-				$variant .= ($variant)?'_'.$variants[$i]:$variants[$i];
153
-				$catalogues[] = $catalogue.'.'.$variant;
152
+				$variant.=($variant) ? '_'.$variants[$i] : $variants[$i];
153
+				$catalogues[]=$catalogue.'.'.$variant;
154 154
 			}
155 155
 		}
156 156
 		return array_reverse($catalogues);
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
 	private function getCatalogueDetails($catalogue='messages')
165 165
 	{
166 166
 		if(empty($catalogue))
167
-			$catalogue = 'messages';
167
+			$catalogue='messages';
168 168
 
169
-		$variant = $catalogue.'.'.$this->culture;
169
+		$variant=$catalogue.'.'.$this->culture;
170 170
 
171 171
 		$command=$this->getDBConnection()->createCommand(
172 172
 			'SELECT cat_id FROM catalogue WHERE name = :variant');
173
-		$command->bindParameter(':variant',$variant,PDO::PARAM_STR);
173
+		$command->bindParameter(':variant', $variant, PDO::PARAM_STR);
174 174
 		$cat_id=$command->queryScalar();
175 175
 
176
-		if ($cat_id===null) return false;
176
+		if($cat_id===null) return false;
177 177
 
178 178
 		$command=$this->getDBConnection()->createCommand(
179 179
 			'SELECT COUNT(msg_id) FROM trans_unit WHERE cat_id = :catid ');
180
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
180
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
181 181
 		$count=$command->queryScalar();
182 182
 
183 183
 		return array($cat_id, $variant, $count);
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	private function updateCatalogueTime($cat_id, $variant)
191 191
 	{
192
-		$time = time();
192
+		$time=time();
193 193
 		$command=$this->getDBConnection()->createCommand(
194 194
 			'UPDATE catalogue SET date_modified = :moddate WHERE cat_id = :catid');
195
-		$command->bindParameter(':moddate',$time,PDO::PARAM_INT);
196
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
195
+		$command->bindParameter(':moddate', $time, PDO::PARAM_INT);
196
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
197 197
 		$result=$command->execute();
198 198
 
199 199
 		if(!empty($this->cache))
@@ -211,31 +211,31 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	function save($catalogue='messages')
213 213
 	{
214
-		$messages = $this->untranslated;
214
+		$messages=$this->untranslated;
215 215
 
216 216
 		if(count($messages) <= 0) return false;
217 217
 
218
-		$details = $this->getCatalogueDetails($catalogue);
218
+		$details=$this->getCatalogueDetails($catalogue);
219 219
 
220 220
 		if($details)
221
-			list($cat_id, $variant, $count) = $details;
221
+			list($cat_id, $variant, $count)=$details;
222 222
 		else
223 223
 			return false;
224 224
 
225 225
 		if($cat_id <= 0) return false;
226
-		$inserted = 0;
226
+		$inserted=0;
227 227
 
228
-		$time = time();
228
+		$time=time();
229 229
 
230 230
 		$command=$this->getDBConnection()->createCommand(
231 231
 			'INSERT INTO trans_unit (cat_id,id,source,date_added) VALUES (:catid,:id,:source,:dateadded)');
232
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
233
-		$command->bindParameter(':id',$count,PDO::PARAM_INT);
234
-		$command->bindParameter(':source',$message,PDO::PARAM_STR);
235
-		$command->bindParameter(':dateadded',$time,PDO::PARAM_INT);
232
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
233
+		$command->bindParameter(':id', $count, PDO::PARAM_INT);
234
+		$command->bindParameter(':source', $message, PDO::PARAM_STR);
235
+		$command->bindParameter(':dateadded', $time, PDO::PARAM_INT);
236 236
 		foreach($messages as $message)
237 237
 		{
238
-			if (empty($message)) continue;
238
+			if(empty($message)) continue;
239 239
 			$count++; $inserted++;
240 240
 			$command->execute();
241 241
 		}
@@ -253,16 +253,16 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	function delete($message, $catalogue='messages')
255 255
 	{
256
-		$details = $this->getCatalogueDetails($catalogue);
256
+		$details=$this->getCatalogueDetails($catalogue);
257 257
 		if($details)
258
-			list($cat_id, $variant, $count) = $details;
258
+			list($cat_id, $variant, $count)=$details;
259 259
 		else
260 260
 			return false;
261 261
 
262 262
 		$command=$this->getDBConnection()->createCommand(
263 263
 			'DELETE FROM trans_unit WHERE cat_id = :catid AND source = :message');
264
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
265
-		$command->bindParameter(':message',$message,PDO::PARAM_STR);
264
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
265
+		$command->bindParameter(':message', $message, PDO::PARAM_STR);
266 266
 
267 267
 		return ($command->execute()==1) ? $this->updateCatalogueTime($cat_id, $variant) : false;
268 268
 
@@ -278,21 +278,21 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	function update($text, $target, $comments, $catalogue='messages')
280 280
 	{
281
-		$details = $this->getCatalogueDetails($catalogue);
281
+		$details=$this->getCatalogueDetails($catalogue);
282 282
 		if($details)
283
-			list($cat_id, $variant, $count) = $details;
283
+			list($cat_id, $variant, $count)=$details;
284 284
 		else
285 285
 			return false;
286 286
 
287
-		$time = time();
287
+		$time=time();
288 288
 		$command=$this->getDBConnection()->createCommand(
289 289
 			'UPDATE trans_unit SET target = :target, comments = :comments, date_modified = :datemod
290 290
 					WHERE cat_id = :catid AND source = :source');
291
-		$command->bindParameter(':target',$target,PDO::PARAM_STR);
292
-		$command->bindParameter(':comments',$comments,PDO::PARAM_STR);
293
-		$command->bindParameter(':datemod',$time,PDO::PARAM_INT);
294
-		$command->bindParameter(':catid',$cat_id,PDO::PARAM_INT);
295
-		$command->bindParameter(':source',$text,PDO::PARAM_STR);
291
+		$command->bindParameter(':target', $target, PDO::PARAM_STR);
292
+		$command->bindParameter(':comments', $comments, PDO::PARAM_STR);
293
+		$command->bindParameter(':datemod', $time, PDO::PARAM_INT);
294
+		$command->bindParameter(':catid', $cat_id, PDO::PARAM_INT);
295
+		$command->bindParameter(':source', $text, PDO::PARAM_STR);
296 296
 
297 297
 		return ($command->execute()==1) ? $this->updateCatalogueTime($cat_id, $variant) : false;
298 298
 	}
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	function catalogues()
305 305
 	{
306
-		$command=$this->getDBConnection()->createCommand( 'SELECT name FROM catalogue ORDER BY name');
306
+		$command=$this->getDBConnection()->createCommand('SELECT name FROM catalogue ORDER BY name');
307 307
 		$dataReader=$command->query();
308 308
 
309
-		$result = array();
309
+		$result=array();
310 310
 
311
-		foreach ($dataReader as $row)
311
+		foreach($dataReader as $row)
312 312
 		{
313
-			$details = explode('.',$row[0]);
314
-			if(!isset($details[1])) $details[1] = null;
313
+			$details=explode('.', $row[0]);
314
+			if(!isset($details[1])) $details[1]=null;
315 315
 
316
-			$result[] = $details;
316
+			$result[]=$details;
317 317
 		}
318 318
 
319 319
 		return $result;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * Creates the DB connection.
69 69
 	 * @param string the module ID for TDataSourceConfig
70
-	 * @return TDbConnection the created DB connection
70
+	 * @param string $connectionID
71
+	 * @return \Prado\Data\TDbConnection the created DB connection
71 72
 	 * @throws TConfigurationException if module ID is invalid or empty
72 73
 	 */
73 74
 	protected function createDbConnection($connectionID)
@@ -192,6 +193,7 @@  discard block
 block discarded – undo
192 193
 
193 194
 	/**
194 195
 	 * Update the catalogue last modified time.
196
+	 * @param string $variant
195 197
 	 * @return boolean true if updated, false otherwise.
196 198
 	 */
197 199
 	private function updateCatalogueTime($cat_id, $variant)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
 				return $conn->getDbConnection();
80 80
 			else
81 81
 				throw new TConfigurationException('messagesource_connectionid_invalid',$connectionID);
82
-		}
83
-		else
82
+		} else
84 83
 			throw new TConfigurationException('messagesource_connectionid_required');
85 84
 	}
86 85
 
Please login to merge, or discard this patch.