Completed
Push — intl ( 51e284 )
by Fabio
06:51
created
framework/Collections/TPagedDataSource.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -68,6 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 	/**
70 70
 	 * @param mixed original data source
71
+	 * @param \Traversable $value
71 72
 	 */
72 73
 	public function setDataSource($value)
73 74
 	{
@@ -93,6 +94,7 @@  discard block
 block discarded – undo
93 94
 
94 95
 	/**
95 96
 	 * @param integer number of items in each page
97
+	 * @param integer $value
96 98
 	 */
97 99
 	public function setPageSize($value)
98 100
 	{
@@ -112,6 +114,7 @@  discard block
 block discarded – undo
112 114
 
113 115
 	/**
114 116
 	 * @param integer current page index
117
+	 * @param integer $value
115 118
 	 */
116 119
 	public function setCurrentPageIndex($value)
117 120
 	{
@@ -130,6 +133,7 @@  discard block
 block discarded – undo
130 133
 
131 134
 	/**
132 135
 	 * @param boolean whether to allow paging
136
+	 * @param boolean $value
133 137
 	 */
134 138
 	public function setAllowPaging($value)
135 139
 	{
@@ -146,6 +150,7 @@  discard block
 block discarded – undo
146 150
 
147 151
 	/**
148 152
 	 * @param boolean whether to allow custom paging
153
+	 * @param boolean $value
149 154
 	 */
150 155
 	public function setAllowCustomPaging($value)
151 156
 	{
@@ -162,6 +167,7 @@  discard block
 block discarded – undo
162 167
 
163 168
 	/**
164 169
 	 * @param integer user-assigned number of items in data source
170
+	 * @param integer $value
165 171
 	 */
166 172
 	public function setVirtualItemCount($value)
167 173
 	{
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function setPageSize($value)
98 98
 	{
99
-		if(($value=TPropertyValue::ensureInteger($value))>0)
99
+		if(($value=TPropertyValue::ensureInteger($value)) > 0)
100 100
 			$this->_pageSize=$value;
101 101
 		else
102 102
 			throw new TInvalidDataValueException('pageddatasource_pagesize_invalid');
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function setCurrentPageIndex($value)
117 117
 	{
118
-		if(($value=TPropertyValue::ensureInteger($value))<0)
118
+		if(($value=TPropertyValue::ensureInteger($value)) < 0)
119 119
 			$value=0;
120 120
 		$this->_currentPageIndex=$value;
121 121
 	}
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function setVirtualItemCount($value)
167 167
 	{
168
-		if(($value=TPropertyValue::ensureInteger($value))>=0)
168
+		if(($value=TPropertyValue::ensureInteger($value)) >= 0)
169 169
 			$this->_virtualCount=$value;
170 170
 		else
171 171
 			throw new TInvalidDataValueException('pageddatasource_virtualitemcount_invalid');
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		if(!$this->_allowPaging)
182 182
 			return $this->getDataSourceCount();
183 183
 		if(!$this->_allowCustomPaging && $this->getIsLastPage())
184
-			return $this->getDataSourceCount()-$this->getFirstIndexInPage();
184
+			return $this->getDataSourceCount() - $this->getFirstIndexInPage();
185 185
 		return $this->_pageSize;
186 186
 	}
187 187
 
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
 		if($this->_dataSource===null)
204 204
 			return 0;
205 205
 		$count=$this->getDataSourceCount();
206
-		if(!$this->_allowPaging || $count<=0)
206
+		if(!$this->_allowPaging || $count <= 0)
207 207
 			return 1;
208
-		return (int)(($count+$this->_pageSize-1)/$this->_pageSize);
208
+		return (int) (($count + $this->_pageSize - 1) / $this->_pageSize);
209 209
 	}
210 210
 
211 211
 	/**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	public function getIsLastPage()
226 226
 	{
227 227
 		if($this->_allowPaging)
228
-			return $this->_currentPageIndex===$this->getPageCount()-1;
228
+			return $this->_currentPageIndex===$this->getPageCount() - 1;
229 229
 		else
230 230
 			return true;
231 231
 	}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	public function getFirstIndexInPage()
238 238
 	{
239 239
 		if($this->_dataSource!==null && $this->_allowPaging && !$this->_allowCustomPaging)
240
-			return $this->_currentPageIndex*$this->_pageSize;
240
+			return $this->_currentPageIndex * $this->_pageSize;
241 241
 		else
242 242
 			return 0;
243 243
 	}
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 	public function getIterator()
262 262
 	{
263 263
 		if($this->_dataSource instanceof TList)
264
-			return new TPagedListIterator($this->_dataSource,$this->getFirstIndexInPage(),$this->getCount());
264
+			return new TPagedListIterator($this->_dataSource, $this->getFirstIndexInPage(), $this->getCount());
265 265
 		else if($this->_dataSource instanceof TMap)
266
-			return new TPagedMapIterator($this->_dataSource,$this->getFirstIndexInPage(),$this->getCount());
266
+			return new TPagedMapIterator($this->_dataSource, $this->getFirstIndexInPage(), $this->getCount());
267 267
 		else
268 268
 			return null;
269 269
 	}
Please login to merge, or discard this patch.
framework/Collections/TPagedListIterator.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -35,6 +35,8 @@
 block discarded – undo
35 35
 	 * @param TList the data to be iterated through
36 36
 	 * @param integer start index
37 37
 	 * @param integer number of items to be iterated through
38
+	 * @param integer $startIndex
39
+	 * @param integer $count
38 40
 	 */
39 41
 	public function __construct(TList $list,$startIndex,$count)
40 42
 	{
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * @param integer start index
37 37
 	 * @param integer number of items to be iterated through
38 38
 	 */
39
-	public function __construct(TList $list,$startIndex,$count)
39
+	public function __construct(TList $list, $startIndex, $count)
40 40
 	{
41 41
 		$this->_list=$list;
42 42
 		$this->_index=0;
43 43
 		$this->_startIndex=$startIndex;
44
-		if($startIndex+$count>$list->getCount())
45
-			$this->_count=$list->getCount()-$startIndex;
44
+		if($startIndex + $count > $list->getCount())
45
+			$this->_count=$list->getCount() - $startIndex;
46 46
 		else
47 47
 			$this->_count=$count;
48 48
 	}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function current()
75 75
 	{
76
-		return $this->_list->itemAt($this->_startIndex+$this->_index);
76
+		return $this->_list->itemAt($this->_startIndex + $this->_index);
77 77
 	}
78 78
 
79 79
 	/**
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function valid()
94 94
 	{
95
-		return $this->_index<$this->_count;
95
+		return $this->_index < $this->_count;
96 96
 	}
97 97
 }
98 98
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Collections/TPagedListPageChangedEventParameter.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -28,6 +28,7 @@
 block discarded – undo
28 28
 	/**
29 29
 	 * Constructor.
30 30
 	 * @param integer old page index
31
+	 * @param integer $oldPage
31 32
 	 */
32 33
 	public function __construct($oldPage)
33 34
 	{
Please login to merge, or discard this patch.
framework/Collections/TPagedMapIterator.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -34,6 +34,8 @@
 block discarded – undo
34 34
 	/**
35 35
 	 * Constructor.
36 36
 	 * @param array the data to be iterated through
37
+	 * @param integer $startIndex
38
+	 * @param integer $count
37 39
 	 */
38 40
 	public function __construct(TMap $map,$startIndex,$count)
39 41
 	{
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 	 * Constructor.
36 36
 	 * @param array the data to be iterated through
37 37
 	 */
38
-	public function __construct(TMap $map,$startIndex,$count)
38
+	public function __construct(TMap $map, $startIndex, $count)
39 39
 	{
40 40
 		$this->_map=$map;
41 41
 		$this->_index=0;
42 42
 		$this->_startIndex=$startIndex;
43
-		if($startIndex+$count>$map->getCount())
44
-			$this->_count=$map->getCount()-$startIndex;
43
+		if($startIndex + $count > $map->getCount())
44
+			$this->_count=$map->getCount() - $startIndex;
45 45
 		else
46 46
 			$this->_count=$count;
47 47
 		$this->_iterator=$map->getIterator();
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	public function rewind()
55 55
 	{
56 56
 		$this->_iterator->rewind();
57
-		for($i=0;$i<$this->_startIndex;++$i)
57
+		for($i=0; $i < $this->_startIndex; ++$i)
58 58
 			$this->_iterator->next();
59 59
 		$this->_index=0;
60 60
 	}
@@ -96,6 +96,6 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function valid()
98 98
 	{
99
-		return $this->_index<$this->_count;
99
+		return $this->_index < $this->_count;
100 100
 	}
101 101
 }
102 102
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Collections/TPriorityList.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,6 +143,7 @@  discard block
 block discarded – undo
143 143
 	/**
144 144
 	 * This must be called internally or when instantiated.
145 145
 	 * @param numeric sets the default priority of inserted items without a specified priority
146
+	 * @param integer $value
146 147
 	 */
147 148
 	protected function setDefaultPriority($value)
148 149
 	{
@@ -160,6 +161,7 @@  discard block
 block discarded – undo
160 161
 	/**
161 162
 	 * This must be called internally or when instantiated.
162 163
 	 * @param integer The precision of numeric priorities.
164
+	 * @param integer $value
163 165
 	 */
164 166
 	protected function setPrecision($value)
165 167
 	{
@@ -169,7 +171,7 @@  discard block
 block discarded – undo
169 171
 	/**
170 172
 	 * Returns an iterator for traversing the items in the list.
171 173
 	 * This method is required by the interface \IteratorAggregate.
172
-	 * @return Iterator an iterator for traversing the items in the list.
174
+	 * @return \ArrayIterator an iterator for traversing the items in the list.
173 175
 	 */
174 176
 	public function getIterator()
175 177
 	{
@@ -596,6 +598,7 @@  discard block
 block discarded – undo
596 598
 	 * Combines the map elements which have a priority below the parameter value
597 599
 	 * @param numeric the cut-off priority.  All items of priority less than this are returned.
598 600
 	 * @param boolean whether or not the input cut-off priority is inclusive.  Default: false, not inclusive.
601
+	 * @param integer $priority
599 602
 	 * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
600 603
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
601 604
 	 */
@@ -616,6 +619,7 @@  discard block
 block discarded – undo
616 619
 	 * Combines the map elements which have a priority above the parameter value
617 620
 	 * @param numeric the cut-off priority.  All items of priority greater than this are returned.
618 621
 	 * @param boolean whether or not the input cut-off priority is inclusive.  Default: true, inclusive.
622
+	 * @param integer $priority
619 623
 	 * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
620 624
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
621 625
 	 */
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -390,8 +390,7 @@  discard block
 block discarded – undo
390 390
 			}
391 391
 			$this->removeAtIndexInPriority($p[1],$p[0]);
392 392
 			return $p[2];
393
-		}
394
-		else
393
+		} else
395 394
 			throw new TInvalidDataValueException('list_item_inexistent');
396 395
 	}
397 396
 
@@ -676,14 +675,12 @@  discard block
 block discarded – undo
676 675
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
677 676
 					$this->insertAtIndexInPriority($item,false,$priority);
678 677
 			}
679
-		}
680
-		else if(is_array($data)||$data instanceof \Traversable)
678
+		} else if(is_array($data)||$data instanceof \Traversable)
681 679
 		{
682 680
 			foreach($data as $priority=>$item)
683 681
 				$this->add($item);
684 682
 
685
-		}
686
-		else if($data!==null)
683
+		} else if($data!==null)
687 684
 			throw new TInvalidDataTypeException('map_data_not_iterable');
688 685
 	}
689 686
 
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param integer the precision of the numeric priorities
88 88
 	 * @throws TInvalidDataTypeException If data is not null and is neither an array nor an iterator.
89 89
 	 */
90
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
90
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
91 91
 	{
92 92
 		parent::__construct();
93 93
 		if($data!==null)
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	{
126 126
 		if($priority===null)
127 127
 			$priority=$this->getDefaultPriority();
128
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
128
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
129 129
 
130 130
 		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
131 131
 			return false;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	protected function setDefaultPriority($value)
148 148
 	{
149
-		$this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p);
149
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
150 150
 	}
151 151
 
152 152
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	protected function sortPriorities() {
194 194
 		if(!$this->_o) {
195
-			ksort($this->_d,SORT_NUMERIC);
195
+			ksort($this->_d, SORT_NUMERIC);
196 196
 			$this->_o=true;
197 197
 		}
198 198
 	}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$this->sortPriorities();
209 209
 		$this->_fd=array();
210 210
 		foreach($this->_d as $priority => $itemsatpriority)
211
-			$this->_fd=array_merge($this->_fd,$itemsatpriority);
211
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
212 212
 		return $this->_fd;
213 213
 	}
214 214
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function itemAt($index)
224 224
 	{
225
-		if($index>=0&&$index<$this->getCount()) {
225
+		if($index >= 0 && $index < $this->getCount()) {
226 226
 			$arr=$this->flattenPriorities();
227 227
 			return $arr[$index];
228 228
 		} else
229
-			throw new TInvalidDataValueException('list_index_invalid',$index);
229
+			throw new TInvalidDataValueException('list_index_invalid', $index);
230 230
 	}
231 231
 
232 232
 	/**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	{
239 239
 		if($priority===null)
240 240
 			$priority=$this->getDefaultPriority();
241
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
241
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
242 242
 
243
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
243
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
244 244
 	}
245 245
 
246 246
 	/**
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 	 * @param numeric the priority which to index.  no parameter or null will result in the default priority
250 250
 	 * @return mixed the element at the offset, false if no element is found at the offset
251 251
 	 */
252
-	public function itemAtIndexInPriority($index,$priority=null)
252
+	public function itemAtIndexInPriority($index, $priority=null)
253 253
 	{
254 254
 		if($priority===null)
255 255
 			$priority=$this->getDefaultPriority();
256
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
256
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
257 257
 
258
-		return !isset($this->_d[$priority])?false:(
259
-				isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false
258
+		return !isset($this->_d[$priority]) ?false:(
259
+				isset($this->_d[$priority][$index]) ? $this->_d[$priority][$index] : false
260 260
 			);
261 261
 	}
262 262
 
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 	 * @return int the index within the flattened array
269 269
 	 * @throws TInvalidOperationException if the map is read-only
270 270
 	 */
271
-	public function add($item,$priority=null)
271
+	public function add($item, $priority=null)
272 272
 	{
273 273
 		if($this->getReadOnly())
274
-			throw new TInvalidOperationException('list_readonly',get_class($this));
274
+			throw new TInvalidOperationException('list_readonly', get_class($this));
275 275
 
276
-		return $this->insertAtIndexInPriority($item,false,$priority,true);
276
+		return $this->insertAtIndexInPriority($item, false, $priority, true);
277 277
 	}
278 278
 
279 279
 	/**
@@ -284,15 +284,15 @@  discard block
 block discarded – undo
284 284
 	 * @throws TInvalidDataValueException If the index specified exceeds the bound
285 285
 	 * @throws TInvalidOperationException if the list is read-only
286 286
 	 */
287
-	public function insertAt($index,$item)
287
+	public function insertAt($index, $item)
288 288
 	{
289 289
 		if($this->getReadOnly())
290
-			throw new TInvalidOperationException('list_readonly',get_class($this));
290
+			throw new TInvalidOperationException('list_readonly', get_class($this));
291 291
 
292
-		if(($priority=$this->priorityAt($index,true))!==false)
293
-			$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
292
+		if(($priority=$this->priorityAt($index, true))!==false)
293
+			$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
294 294
 		else
295
-			throw new TInvalidDataValueException('list_index_invalid',$index);
295
+			throw new TInvalidDataValueException('list_index_invalid', $index);
296 296
 	}
297 297
 
298 298
 	/**
@@ -305,54 +305,54 @@  discard block
 block discarded – undo
305 305
 	 * @throws TInvalidDataValueException If the index specified exceeds the bound
306 306
 	 * @throws TInvalidOperationException if the list is read-only
307 307
 	 */
308
-	public function insertAtIndexInPriority($item,$index=false,$priority=null,$preserveCache=false)
308
+	public function insertAtIndexInPriority($item, $index=false, $priority=null, $preserveCache=false)
309 309
 	{
310 310
 		if($this->getReadOnly())
311
-			throw new TInvalidOperationException('list_readonly',get_class($this));
311
+			throw new TInvalidOperationException('list_readonly', get_class($this));
312 312
 
313 313
 		if($priority===null)
314 314
 			$priority=$this->getDefaultPriority();
315
-		$priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p);
315
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
316 316
 
317 317
 		if($preserveCache) {
318 318
 			$this->sortPriorities();
319 319
 			$cc=0;
320 320
 			foreach($this->_d as $prioritykey=>$items)
321
-				if($prioritykey>=$priority)
321
+				if($prioritykey >= $priority)
322 322
 					break;
323 323
 				else
324 324
 					$cc+=count($items);
325 325
 
326
-			if($index===false&&isset($this->_d[$priority])) {
326
+			if($index===false && isset($this->_d[$priority])) {
327 327
 				$c=count($this->_d[$priority]);
328 328
 				$c+=$cc;
329 329
 				$this->_d[$priority][]=$item;
330 330
 			} else if(isset($this->_d[$priority])) {
331
-				$c=$index+$cc;
332
-				array_splice($this->_d[$priority],$index,0,array($item));
331
+				$c=$index + $cc;
332
+				array_splice($this->_d[$priority], $index, 0, array($item));
333 333
 			} else {
334
-				$c = $cc;
335
-				$this->_o = false;
334
+				$c=$cc;
335
+				$this->_o=false;
336 336
 				$this->_d[$priority]=array($item);
337 337
 			}
338 338
 
339
-			if($this->_fd&&is_array($this->_fd)) // if there is a flattened array cache
340
-				array_splice($this->_fd,$c,0,array($item));
339
+			if($this->_fd && is_array($this->_fd)) // if there is a flattened array cache
340
+				array_splice($this->_fd, $c, 0, array($item));
341 341
 		} else {
342 342
 			$c=null;
343
-			if($index===false&&isset($this->_d[$priority])) {
343
+			if($index===false && isset($this->_d[$priority])) {
344 344
 				$cc=count($this->_d[$priority]);
345 345
 				$this->_d[$priority][]=$item;
346 346
 			} else if(isset($this->_d[$priority])) {
347 347
 				$cc=$index;
348
-				array_splice($this->_d[$priority],$index,0,array($item));
348
+				array_splice($this->_d[$priority], $index, 0, array($item));
349 349
 			} else {
350 350
 				$cc=0;
351 351
 				$this->_o=false;
352 352
 				$this->_d[$priority]=array($item);
353 353
 			}
354
-			if($this->_fd&&is_array($this->_fd)&&count($this->_d)==1)
355
-				array_splice($this->_fd,$cc,0,array($item));
354
+			if($this->_fd && is_array($this->_fd) && count($this->_d)==1)
355
+				array_splice($this->_fd, $cc, 0, array($item));
356 356
 			else
357 357
 				$this->_fd=null;
358 358
 		}
@@ -373,22 +373,22 @@  discard block
 block discarded – undo
373 373
 	 * @return integer index within the flattened list at which the item is being removed
374 374
 	 * @throws TInvalidDataValueException If the item does not exist
375 375
 	 */
376
-	public function remove($item,$priority=false)
376
+	public function remove($item, $priority=false)
377 377
 	{
378 378
 		if($this->getReadOnly())
379
-			throw new TInvalidOperationException('list_readonly',get_class($this));
379
+			throw new TInvalidOperationException('list_readonly', get_class($this));
380 380
 
381
-		if(($p=$this->priorityOf($item,true))!==false)
381
+		if(($p=$this->priorityOf($item, true))!==false)
382 382
 		{
383 383
 			if($priority!==false) {
384 384
 				if($priority===null)
385 385
 					$priority=$this->getDefaultPriority();
386
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
386
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
387 387
 
388 388
 				if($p[0]!=$priority)
389 389
 					throw new TInvalidDataValueException('list_item_inexistent');
390 390
 			}
391
-			$this->removeAtIndexInPriority($p[1],$p[0]);
391
+			$this->removeAtIndexInPriority($p[1], $p[0]);
392 392
 			return $p[2];
393 393
 		}
394 394
 		else
@@ -405,11 +405,11 @@  discard block
 block discarded – undo
405 405
 	public function removeAt($index)
406 406
 	{
407 407
 		if($this->getReadOnly())
408
-			throw new TInvalidOperationException('list_readonly',get_class($this));
408
+			throw new TInvalidOperationException('list_readonly', get_class($this));
409 409
 
410 410
 		if(($priority=$this->priorityAt($index, true))!==false)
411
-			return $this->removeAtIndexInPriority($priority[1],$priority[0]);
412
-		throw new TInvalidDataValueException('list_index_invalid',$index);
411
+			return $this->removeAtIndexInPriority($priority[1], $priority[0]);
412
+		throw new TInvalidDataValueException('list_index_invalid', $index);
413 413
 	}
414 414
 
415 415
 	/**
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 	public function removeAtIndexInPriority($index, $priority=null)
424 424
 	{
425 425
 		if($this->getReadOnly())
426
-			throw new TInvalidOperationException('list_readonly',get_class($this));
426
+			throw new TInvalidOperationException('list_readonly', get_class($this));
427 427
 
428 428
 		if($priority===null)
429 429
 			$priority=$this->getDefaultPriority();
430
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
430
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
431 431
 
432
-		if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority]))
432
+		if(!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority]))
433 433
 			throw new TInvalidDataValueException('list_item_inexistent');
434 434
 
435 435
 		// $value is an array of elements removed, only one
436
-		$value=array_splice($this->_d[$priority],$index,1);
436
+		$value=array_splice($this->_d[$priority], $index, 1);
437 437
 		$value=$value[0];
438 438
 
439 439
 		if(!count($this->_d[$priority]))
@@ -450,12 +450,12 @@  discard block
 block discarded – undo
450 450
 	public function clear()
451 451
 	{
452 452
 		if($this->getReadOnly())
453
-			throw new TInvalidOperationException('list_readonly',get_class($this));
453
+			throw new TInvalidOperationException('list_readonly', get_class($this));
454 454
 
455
-		$d=array_reverse($this->_d,true);
455
+		$d=array_reverse($this->_d, true);
456 456
 		foreach($this->_d as $priority=>$items) {
457
-			for($index=count($items)-1;$index>=0;$index--)
458
-				$this->removeAtIndexInPriority($index,$priority);
457
+			for($index=count($items) - 1; $index >= 0; $index--)
458
+				$this->removeAtIndexInPriority($index, $priority);
459 459
 			unset($this->_d[$priority]);
460 460
 		}
461 461
 	}
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	public function contains($item)
468 468
 	{
469
-		return $this->indexOf($item)>=0;
469
+		return $this->indexOf($item) >= 0;
470 470
 	}
471 471
 
472 472
 	/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 */
476 476
 	public function indexOf($item)
477 477
 	{
478
-		if(($index=array_search($item,$this->flattenPriorities(),true))===false)
478
+		if(($index=array_search($item, $this->flattenPriorities(), true))===false)
479 479
 			return -1;
480 480
 		else
481 481
 			return $index;
@@ -490,16 +490,16 @@  discard block
 block discarded – undo
490 490
 	 *   if withindex is true, an array is returned of [0 => $priority, 1 => $priorityIndex, 2 => flattenedIndex,
491 491
 	 * 'priority' => $priority, 'index' => $priorityIndex, 'absindex' => flattenedIndex]
492 492
 	 */
493
-	public function priorityOf($item,$withindex = false)
493
+	public function priorityOf($item, $withindex=false)
494 494
 	{
495 495
 		$this->sortPriorities();
496 496
 
497
-		$absindex = 0;
497
+		$absindex=0;
498 498
 		foreach($this->_d as $priority=>$items) {
499
-			if(($index=array_search($item,$items,true))!==false) {
499
+			if(($index=array_search($item, $items, true))!==false) {
500 500
 				$absindex+=$index;
501
-				return $withindex?array($priority,$index,$absindex,
502
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
501
+				return $withindex ? array($priority, $index, $absindex,
502
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
503 503
 			} else
504 504
 				$absindex+=count($items);
505 505
 		}
@@ -516,19 +516,19 @@  discard block
 block discarded – undo
516 516
 	 *   if withindex is true, an array is returned of [0 => $priority, 1 => $priorityIndex, 2 => flattenedIndex,
517 517
 	 * 'priority' => $priority, 'index' => $priorityIndex, 'absindex' => flattenedIndex]
518 518
 	 */
519
-	public function priorityAt($index,$withindex = false)
519
+	public function priorityAt($index, $withindex=false)
520 520
 	{
521
-		if($index<0||$index>=$this->getCount())
522
-			throw new TInvalidDataValueException('list_index_invalid',$index);
521
+		if($index < 0 || $index >= $this->getCount())
522
+			throw new TInvalidDataValueException('list_index_invalid', $index);
523 523
 
524 524
 		$absindex=$index;
525 525
 		$this->sortPriorities();
526 526
 		foreach($this->_d as $priority=>$items) {
527
-			if($index>=($c=count($items)))
527
+			if($index >= ($c=count($items)))
528 528
 				$index-=$c;
529 529
 			else
530
-				return $withindex?array($priority,$index,$absindex,
531
-						'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority;
530
+				return $withindex ? array($priority, $index, $absindex,
531
+						'priority'=>$priority, 'index'=>$index, 'absindex'=>$absindex) : $priority;
532 532
 		}
533 533
 		return false;
534 534
 	}
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
 	public function insertBefore($indexitem, $item)
545 545
 	{
546 546
 		if($this->getReadOnly())
547
-			throw new TInvalidOperationException('list_readonly',get_class($this));
547
+			throw new TInvalidOperationException('list_readonly', get_class($this));
548 548
 
549
-		if(($priority=$this->priorityOf($indexitem,true))===false)
549
+		if(($priority=$this->priorityOf($indexitem, true))===false)
550 550
 			throw new TInvalidDataValueException('list_item_inexistent');
551 551
 
552
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
552
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
553 553
 
554 554
 		return $priority[2];
555 555
 	}
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 	public function insertAfter($indexitem, $item)
566 566
 	{
567 567
 		if($this->getReadOnly())
568
-			throw new TInvalidOperationException('list_readonly',get_class($this));
568
+			throw new TInvalidOperationException('list_readonly', get_class($this));
569 569
 
570
-		if(($priority=$this->priorityOf($indexitem,true))===false)
570
+		if(($priority=$this->priorityOf($indexitem, true))===false)
571 571
 			throw new TInvalidDataValueException('list_item_inexistent');
572 572
 
573
-		$this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]);
573
+		$this->insertAtIndexInPriority($item, $priority[1] + 1, $priority[0]);
574 574
 
575
-		return $priority[2]+1;
575
+		return $priority[2] + 1;
576 576
 	}
577 577
 
578 578
 	/**
@@ -599,15 +599,15 @@  discard block
 block discarded – undo
599 599
 	 * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
600 600
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
601 601
 	 */
602
-	public function toArrayBelowPriority($priority,$inclusive=false)
602
+	public function toArrayBelowPriority($priority, $inclusive=false)
603 603
 	{
604 604
 		$this->sortPriorities();
605 605
 		$items=array();
606 606
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
607 607
 		{
608
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
608
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
609 609
 				break;
610
-			$items=array_merge($items,$itemsatpriority);
610
+			$items=array_merge($items, $itemsatpriority);
611 611
 		}
612 612
 		return $items;
613 613
 	}
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 	 * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
620 620
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
621 621
 	 */
622
-	public function toArrayAbovePriority($priority,$inclusive=true)
622
+	public function toArrayAbovePriority($priority, $inclusive=true)
623 623
 	{
624 624
 		$this->sortPriorities();
625 625
 		$items=array();
626 626
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
627 627
 		{
628
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
628
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
629 629
 				continue;
630
-			$items=array_merge($items,$itemsatpriority);
630
+			$items=array_merge($items, $itemsatpriority);
631 631
 		}
632 632
 		return $items;
633 633
 	}
@@ -643,15 +643,15 @@  discard block
 block discarded – undo
643 643
 	{
644 644
 		if($data instanceof TPriorityList)
645 645
 		{
646
-			if($this->getCount()>0)
646
+			if($this->getCount() > 0)
647 647
 				$this->clear();
648 648
 			foreach($data->getPriorities() as $priority)
649 649
 			{
650 650
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
651
-					$this->insertAtIndexInPriority($item,$index,$priority);
651
+					$this->insertAtIndexInPriority($item, $index, $priority);
652 652
 			}
653
-		} else if(is_array($data)||$data instanceof \Traversable) {
654
-			if($this->getCount()>0)
653
+		} else if(is_array($data) || $data instanceof \Traversable) {
654
+			if($this->getCount() > 0)
655 655
 				$this->clear();
656 656
 			foreach($data as $key=>$item)
657 657
 				$this->add($item);
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
 			foreach($data->getPriorities() as $priority)
675 675
 			{
676 676
 				foreach($data->itemsAtPriority($priority) as $index=>$item)
677
-					$this->insertAtIndexInPriority($item,false,$priority);
677
+					$this->insertAtIndexInPriority($item, false, $priority);
678 678
 			}
679 679
 		}
680
-		else if(is_array($data)||$data instanceof \Traversable)
680
+		else if(is_array($data) || $data instanceof \Traversable)
681 681
 		{
682 682
 			foreach($data as $priority=>$item)
683 683
 				$this->add($item);
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function offsetExists($offset)
697 697
 	{
698
-		return ($offset>=0&&$offset<$this->getCount());
698
+		return ($offset >= 0 && $offset < $this->getCount());
699 699
 	}
700 700
 
701 701
 	/**
@@ -721,18 +721,18 @@  discard block
 block discarded – undo
721 721
 	 * @param integer the offset to set element
722 722
 	 * @param mixed the element value
723 723
 	 */
724
-	public function offsetSet($offset,$item)
724
+	public function offsetSet($offset, $item)
725 725
 	{
726 726
 		if($offset===null)
727 727
 			return $this->add($item);
728 728
 		if($offset===$this->getCount()) {
729
-			$priority=$this->priorityAt($offset-1,true);
729
+			$priority=$this->priorityAt($offset - 1, true);
730 730
 			$priority[1]++;
731 731
 		} else {
732
-			$priority=$this->priorityAt($offset,true);
733
-			$this->removeAtIndexInPriority($priority[1],$priority[0]);
732
+			$priority=$this->priorityAt($offset, true);
733
+			$this->removeAtIndexInPriority($priority[1], $priority[0]);
734 734
 		}
735
-		$this->insertAtIndexInPriority($item,$priority[1],$priority[0]);
735
+		$this->insertAtIndexInPriority($item, $priority[1], $priority[0]);
736 736
 	}
737 737
 
738 738
 	/**
Please login to merge, or discard this patch.
framework/Collections/TPriorityMap.php 3 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,6 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
 	/**
120 120
 	 * @param boolean whether this list is read-only or not
121
+	 * @param boolean $value
121 122
 	 */
122 123
 	protected function setReadOnly($value)
123 124
 	{
@@ -135,6 +136,7 @@  discard block
 block discarded – undo
135 136
 	/**
136 137
 	 * This must be called internally or when instantiated.
137 138
 	 * @param numeric sets the default priority of inserted items without a specified priority
139
+	 * @param integer $value
138 140
 	 */
139 141
 	protected function setDefaultPriority($value)
140 142
 	{
@@ -152,6 +154,7 @@  discard block
 block discarded – undo
152 154
 	/**
153 155
 	 * This must be called internally or when instantiated.
154 156
 	 * @param integer The precision of numeric priorities.
157
+	 * @param integer $value
155 158
 	 */
156 159
 	protected function setPrecision($value)
157 160
 	{
@@ -161,7 +164,7 @@  discard block
 block discarded – undo
161 164
 	/**
162 165
 	 * Returns an iterator for traversing the items in the map.
163 166
 	 * This method is required by the interface \IteratorAggregate.
164
-	 * @return Iterator an iterator for traversing the items in the map.
167
+	 * @return \ArrayIterator an iterator for traversing the items in the map.
165 168
 	 */
166 169
 	public function getIterator()
167 170
 	{
@@ -342,7 +345,7 @@  discard block
 block discarded – undo
342 345
 	 * @param mixed key
343 346
 	 * @param mixed value
344 347
 	 * @param numeric|null priority, default: null, filled in with default priority
345
-	 * @return numeric priority at which the pair was added
348
+	 * @return string priority at which the pair was added
346 349
 	 * @throws TInvalidOperationException if the map is read-only
347 350
 	 */
348 351
 	public function add($key,$value,$priority=null)
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param integer the precision of the numeric priorities
100 100
 	 * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator.
101 101
 	 */
102
-	public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8)
102
+	public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8)
103 103
 	{
104 104
 		if($data!==null)
105 105
 			$this->copyFrom($data);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	protected function setDefaultPriority($value)
140 140
 	{
141
-		$this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p);
141
+		$this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p);
142 142
 	}
143 143
 
144 144
 	/**
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 			return $this->_fd;
189 189
 
190 190
 		$this->sortPriorities();
191
-		$this->_fd = array();
191
+		$this->_fd=array();
192 192
 		foreach($this->_d as $priority => $itemsatpriority)
193
-			$this->_fd = array_merge($this->_fd, $itemsatpriority);
193
+			$this->_fd=array_merge($this->_fd, $itemsatpriority);
194 194
 		return $this->_fd;
195 195
 	}
196 196
 
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	{
223 223
 		if($priority===null)
224 224
 			$priority=$this->getDefaultPriority();
225
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
225
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
226 226
 
227
-		if(!isset($this->_d[$priority])||!is_array($this->_d[$priority]))
227
+		if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority]))
228 228
 			return false;
229 229
 		return count($this->_d[$priority]);
230 230
 	}
@@ -256,16 +256,16 @@  discard block
 block discarded – undo
256 256
 	 * and numeric is a specific priority.  default: false, any priority.
257 257
 	 * @return mixed the element at the offset, null if no element is found at the offset
258 258
 	 */
259
-	public function itemAt($key,$priority=false)
259
+	public function itemAt($key, $priority=false)
260 260
 	{
261
-		if($priority===false){
261
+		if($priority===false) {
262 262
 			$map=$this->flattenPriorities();
263
-			return isset($map[$key])?$map[$key]:null;
263
+			return isset($map[$key]) ? $map[$key] : null;
264 264
 		} else {
265 265
 			if($priority===null)
266 266
 				$priority=$this->getDefaultPriority();
267
-			$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
268
-			return (isset($this->_d[$priority])&&isset($this->_d[$priority][$key]))?$this->_d[$priority][$key]:null;
267
+			$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
268
+			return (isset($this->_d[$priority]) && isset($this->_d[$priority][$key])) ? $this->_d[$priority][$key] : null;
269 269
 		}
270 270
 	}
271 271
 
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 	 * @param numeric|null the priority.  default: null, filled in with the default priority numeric.
277 277
 	 * @return numeric old priority of the item
278 278
 	 */
279
-	public function setPriorityAt($key,$priority=null)
279
+	public function setPriorityAt($key, $priority=null)
280 280
 	{
281 281
 		if($priority===null)
282 282
 			$priority=$this->getDefaultPriority();
283
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
283
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
284 284
 
285 285
 		$oldpriority=$this->priorityAt($key);
286
-		if($oldpriority!==false&&$oldpriority!=$priority) {
287
-			$value=$this->remove($key,$oldpriority);
288
-			$this->add($key,$value,$priority);
286
+		if($oldpriority!==false && $oldpriority!=$priority) {
287
+			$value=$this->remove($key, $oldpriority);
288
+			$this->add($key, $value, $priority);
289 289
 		}
290 290
 		return $oldpriority;
291 291
 	}
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 	{
300 300
 		if($priority===null)
301 301
 			$priority=$this->getDefaultPriority();
302
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
302
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
303 303
 
304
-		return isset($this->_d[$priority])?$this->_d[$priority]:null;
304
+		return isset($this->_d[$priority]) ? $this->_d[$priority] : null;
305 305
 	}
306 306
 
307 307
 	/**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	{
314 314
 		$this->sortPriorities();
315 315
 		foreach($this->_d as $priority=>$items)
316
-			if(($index=array_search($item,$items,true))!==false)
316
+			if(($index=array_search($item, $items, true))!==false)
317 317
 				return $priority;
318 318
 		return false;
319 319
 	}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	{
328 328
 		$this->sortPriorities();
329 329
 		foreach($this->_d as $priority=>$items)
330
-			if(array_key_exists($key,$items))
330
+			if(array_key_exists($key, $items))
331 331
 				return $priority;
332 332
 		return false;
333 333
 	}
@@ -345,16 +345,16 @@  discard block
 block discarded – undo
345 345
 	 * @return numeric priority at which the pair was added
346 346
 	 * @throws TInvalidOperationException if the map is read-only
347 347
 	 */
348
-	public function add($key,$value,$priority=null)
348
+	public function add($key, $value, $priority=null)
349 349
 	{
350 350
 		if($priority===null)
351 351
 			$priority=$this->getDefaultPriority();
352
-		$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
352
+		$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
353 353
 
354 354
 		if(!$this->_r)
355 355
 		{
356 356
 			foreach($this->_d as $innerpriority=>$items)
357
-				if(array_key_exists($key,$items))
357
+				if(array_key_exists($key, $items))
358 358
 				{
359 359
 					unset($this->_d[$innerpriority][$key]);
360 360
 					$this->_c--;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			$this->_fd=null;
372 372
 		}
373 373
 		else
374
-			throw new TInvalidOperationException('map_readonly',get_class($this));
374
+			throw new TInvalidOperationException('map_readonly', get_class($this));
375 375
 		return $priority;
376 376
 	}
377 377
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * @return mixed the removed value, null if no such key exists.
388 388
 	 * @throws TInvalidOperationException if the map is read-only
389 389
 	 */
390
-	public function remove($key,$priority=false)
390
+	public function remove($key, $priority=false)
391 391
 	{
392 392
 		if(!$this->_r)
393 393
 		{
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 			{
399 399
 				$this->sortPriorities();
400 400
 				foreach($this->_d as $priority=>$items)
401
-					if(array_key_exists($key,$items))
401
+					if(array_key_exists($key, $items))
402 402
 					{
403 403
 						$value=$this->_d[$priority][$key];
404 404
 						unset($this->_d[$priority][$key]);
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
 			}
416 416
 			else
417 417
 			{
418
-				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
419
-				if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority])))
418
+				$priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p);
419
+				if(isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority])))
420 420
 				{
421 421
 					$value=$this->_d[$priority][$key];
422 422
 					unset($this->_d[$priority][$key]);
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			}
434 434
 		}
435 435
 		else
436
-			throw new TInvalidOperationException('map_readonly',get_class($this));
436
+			throw new TInvalidOperationException('map_readonly', get_class($this));
437 437
 	}
438 438
 
439 439
 	/**
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	public function contains($key)
454 454
 	{
455 455
 		$map=$this->flattenPriorities();
456
-		return isset($map[$key])||array_key_exists($key,$map);
456
+		return isset($map[$key]) || array_key_exists($key, $map);
457 457
 	}
458 458
 
459 459
 	/**
@@ -474,15 +474,15 @@  discard block
 block discarded – undo
474 474
 	 * @return array the array of priorities keys with values of arrays of items that are below a specified priority.
475 475
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
476 476
 	 */
477
-	public function toArrayBelowPriority($priority,$inclusive=false)
477
+	public function toArrayBelowPriority($priority, $inclusive=false)
478 478
 	{
479 479
 		$this->sortPriorities();
480 480
 		$items=array();
481 481
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
482 482
 		{
483
-			if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority)
483
+			if((!$inclusive && $itemspriority >= $priority) || $itemspriority > $priority)
484 484
 				break;
485
-			$items=array_merge($items,$itemsatpriority);
485
+			$items=array_merge($items, $itemsatpriority);
486 486
 		}
487 487
 		return $items;
488 488
 	}
@@ -494,15 +494,15 @@  discard block
 block discarded – undo
494 494
 	 * @return array the array of priorities keys with values of arrays of items that are above a specified priority.
495 495
 	 *  The priorities are sorted so important priorities, lower numerics, are first.
496 496
 	 */
497
-	public function toArrayAbovePriority($priority,$inclusive=true)
497
+	public function toArrayAbovePriority($priority, $inclusive=true)
498 498
 	{
499 499
 		$this->sortPriorities();
500 500
 		$items=array();
501 501
 		foreach($this->_d as $itemspriority=>$itemsatpriority)
502 502
 		{
503
-			if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority)
503
+			if((!$inclusive && $itemspriority <= $priority) || $itemspriority < $priority)
504 504
 				continue;
505
-			$items=array_merge($items,$itemsatpriority);
505
+			$items=array_merge($items, $itemsatpriority);
506 506
 		}
507 507
 		return $items;
508 508
 	}
@@ -518,20 +518,20 @@  discard block
 block discarded – undo
518 518
 	{
519 519
 		if($data instanceof TPriorityMap)
520 520
 		{
521
-			if($this->getCount()>0)
521
+			if($this->getCount() > 0)
522 522
 				$this->clear();
523 523
 			foreach($data->getPriorities() as $priority) {
524 524
 				foreach($data->itemsAtPriority($priority) as $key => $value) {
525
-					$this->add($key,$value,$priority);
525
+					$this->add($key, $value, $priority);
526 526
 				}
527 527
 			}
528 528
 		}
529
-		else if(is_array($data)||$data instanceof \Traversable)
529
+		else if(is_array($data) || $data instanceof \Traversable)
530 530
 		{
531
-			if($this->getCount()>0)
531
+			if($this->getCount() > 0)
532 532
 				$this->clear();
533 533
 			foreach($data as $key=>$value)
534
-				$this->add($key,$value);
534
+				$this->add($key, $value);
535 535
 		}
536 536
 		else if($data!==null)
537 537
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -551,13 +551,13 @@  discard block
 block discarded – undo
551 551
 			foreach($data->getPriorities() as $priority)
552 552
 			{
553 553
 				foreach($data->itemsAtPriority($priority) as $key => $value)
554
-					$this->add($key,$value,$priority);
554
+					$this->add($key, $value, $priority);
555 555
 			}
556 556
 		}
557
-		else if(is_array($data)||$data instanceof \Traversable)
557
+		else if(is_array($data) || $data instanceof \Traversable)
558 558
 		{
559 559
 			foreach($data as $key=>$value)
560
-				$this->add($key,$value);
560
+				$this->add($key, $value);
561 561
 		}
562 562
 		else if($data!==null)
563 563
 			throw new TInvalidDataTypeException('map_data_not_iterable');
@@ -591,9 +591,9 @@  discard block
 block discarded – undo
591 591
 	 * @param integer the offset to set element
592 592
 	 * @param mixed the element value
593 593
 	 */
594
-	public function offsetSet($offset,$item)
594
+	public function offsetSet($offset, $item)
595 595
 	{
596
-		$this->add($offset,$item);
596
+		$this->add($offset, $item);
597 597
 	}
598 598
 
599 599
 	/**
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -364,13 +364,11 @@  discard block
 block discarded – undo
364 364
 			if(!isset($this->_d[$priority])) {
365 365
 				$this->_d[$priority]=array($key=>$value);
366 366
 				$this->_o=false;
367
-			}
368
-			else
367
+			} else
369 368
 				$this->_d[$priority][$key]=$value;
370 369
 			$this->_c++;
371 370
 			$this->_fd=null;
372
-		}
373
-		else
371
+		} else
374 372
 			throw new TInvalidOperationException('map_readonly',get_class($this));
375 373
 		return $priority;
376 374
 	}
@@ -412,8 +410,7 @@  discard block
 block discarded – undo
412 410
 						return $value;
413 411
 					}
414 412
 				return null;
415
-			}
416
-			else
413
+			} else
417 414
 			{
418 415
 				$priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p);
419 416
 				if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority])))
@@ -427,12 +424,10 @@  discard block
 block discarded – undo
427 424
 					}
428 425
 					$this->_fd=null;
429 426
 					return $value;
430
-				}
431
-				else
427
+				} else
432 428
 					return null;
433 429
 			}
434
-		}
435
-		else
430
+		} else
436 431
 			throw new TInvalidOperationException('map_readonly',get_class($this));
437 432
 	}
438 433
 
@@ -525,15 +520,13 @@  discard block
 block discarded – undo
525 520
 					$this->add($key,$value,$priority);
526 521
 				}
527 522
 			}
528
-		}
529
-		else if(is_array($data)||$data instanceof \Traversable)
523
+		} else if(is_array($data)||$data instanceof \Traversable)
530 524
 		{
531 525
 			if($this->getCount()>0)
532 526
 				$this->clear();
533 527
 			foreach($data as $key=>$value)
534 528
 				$this->add($key,$value);
535
-		}
536
-		else if($data!==null)
529
+		} else if($data!==null)
537 530
 			throw new TInvalidDataTypeException('map_data_not_iterable');
538 531
 	}
539 532
 
@@ -553,13 +546,11 @@  discard block
 block discarded – undo
553 546
 				foreach($data->itemsAtPriority($priority) as $key => $value)
554 547
 					$this->add($key,$value,$priority);
555 548
 			}
556
-		}
557
-		else if(is_array($data)||$data instanceof \Traversable)
549
+		} else if(is_array($data)||$data instanceof \Traversable)
558 550
 		{
559 551
 			foreach($data as $key=>$value)
560 552
 				$this->add($key,$value);
561
-		}
562
-		else if($data!==null)
553
+		} else if($data!==null)
563 554
 			throw new TInvalidDataTypeException('map_data_not_iterable');
564 555
 	}
565 556
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -52,6 +52,10 @@  discard block
 block discarded – undo
52 52
 		}
53 53
 	}
54 54
 
55
+	/**
56
+	 * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent
57
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
58
+	 */
55 59
 	public function createScaffoldInput($parent, $item, $column, $record)
56 60
 	{
57 61
 		$this->_parent=$parent;
@@ -68,6 +72,10 @@  discard block
 block discarded – undo
68 72
 		$label->setForControl(self::DEFAULT_ID);
69 73
 	}
70 74
 
75
+	/**
76
+	 * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent
77
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
78
+	 */
71 79
 	public function loadScaffoldInput($parent, $item, $column, $record)
72 80
 	{
73 81
 		$this->_parent=$parent;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 class TScaffoldInputBase
17 17
 {
18
-	const DEFAULT_ID = 'scaffold_input';
18
+	const DEFAULT_ID='scaffold_input';
19 19
 	private $_parent;
20 20
 
21 21
 	protected function getParent()
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	public static function createInputBuilder($record)
27 27
 	{
28 28
 		$record->getDbConnection()->setActive(true); //must be connected before retrieving driver name!
29
-		$driver = $record->getDbConnection()->getDriverName();
29
+		$driver=$record->getDbConnection()->getDriverName();
30 30
 		switch(strtolower($driver))
31 31
 		{
32 32
 			case 'sqlite': //sqlite 3
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 				return new TIbmScaffoldInput($conn);
49 49
 			default:
50 50
 				throw new TConfigurationException(
51
-					'scaffold_invalid_database_driver',$driver);
51
+					'scaffold_invalid_database_driver', $driver);
52 52
 		}
53 53
 	}
54 54
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
 	protected function createControlLabel($label, $column, $record)
65 65
 	{
66
-		$fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())).':';
66
+		$fieldname=ucwords(str_replace('_', ' ', $column->getColumnId())).':';
67 67
 		$label->setText($fieldname);
68 68
 		$label->setForControl(self::DEFAULT_ID);
69 69
 	}
@@ -73,20 +73,20 @@  discard block
 block discarded – undo
73 73
 		$this->_parent=$parent;
74 74
 		if($this->getIsEnabled($column, $record))
75 75
 		{
76
-			$prop = $column->getColumnId();
76
+			$prop=$column->getColumnId();
77 77
 			$record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record));
78 78
 		}
79 79
 	}
80 80
 
81 81
 	protected function getIsEnabled($column, $record)
82 82
 	{
83
-		return !($this->getParent()->getRecordPk() !== null
83
+		return !($this->getParent()->getRecordPk()!==null
84 84
 				&& $column->getIsPrimaryKey() || $column->hasSequence());
85 85
 	}
86 86
 
87 87
 	protected function getRecordPropertyValue($column, $record)
88 88
 	{
89
-		$value = $record->getColumnValue($column->getColumnId());
89
+		$value=$record->getColumnValue($column->getColumnId());
90 90
 		if($column->getDefaultValue()!==TDbTableColumn::UNDEFINED_VALUE && $value===null)
91 91
 			return $column->getDefaultValue();
92 92
 		else
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/IScaffoldEditRenderer.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -28,6 +28,7 @@
 block discarded – undo
28 28
 	/**
29 29
 	 * This method should update the record with the user input data.
30 30
 	 * @param TActiveRecord record to be saved.
31
+	 * @param \Prado\Data\ActiveRecord\TActiveRecord $record
31 32
 	 */
32 33
 	public function updateRecord($record);
33 34
 }
34 35
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @link https://github.com/pradosoft/prado
7 7
  * @copyright Copyright &copy; 2005-2016 The PRADO Group
8 8
  * @license https://github.com/pradosoft/prado/blob/master/LICENSE
9
-  * @package Prado\Data\ActiveRecord\Scaffold
9
+ * @package Prado\Data\ActiveRecord\Scaffold
10 10
  */
11 11
 
12 12
 namespace Prado\Data\ActiveRecord\Scaffold;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * that is called before the save() method is called on the TActiveRecord.
21 21
  *
22 22
  * @author Wei Zhuo <weizho[at]gmail[dot]com>
23
-  * @package Prado\Data\ActiveRecord\Scaffold
23
+ * @package Prado\Data\ActiveRecord\Scaffold
24 24
  * @since 3.1
25 25
  */
26 26
 interface IScaffoldEditRenderer extends \Prado\IDataRenderer
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordManager.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -76,6 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * @param TDbConnection default database connection
79
+	 * @param \Prado\Data\TDbConnection $conn
79 80
 	 */
80 81
 	public function setDbConnection($conn)
81 82
 	{
@@ -91,6 +92,7 @@  discard block
 block discarded – undo
91 92
 	}
92 93
 
93 94
 	/**
95
+	 * @param \Prado\TComponent $self
94 96
 	 * @return TActiveRecordManager static instance of record manager.
95 97
 	 */
96 98
 	public static function getInstance($self=null)
@@ -153,6 +155,7 @@  discard block
 block discarded – undo
153 155
 	/**
154 156
 	 * Define the way an active record finder react if an invalid magic-finder invoked
155 157
 	 * @param TActiveRecordInvalidFinderResult
158
+	 * @param TActiveRecordInvalidFinderResult $value
156 159
 	 * @since 3.1.5
157 160
 	 * @see getInvalidFinderResult
158 161
 	 */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class TActiveRecordManager extends \Prado\TComponent
38 38
 {
39
-	const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway';
39
+	const DEFAULT_GATEWAY_CLASS='System.Data.ActiveRecord.TActiveRecordGateway';
40 40
 
41 41
 	/**
42 42
 	 * Defaults to {@link TActiveRecordManager::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
43 43
 	 * @var string
44 44
 	 */
45
-	private $_gatewayClass = self::DEFAULT_GATEWAY_CLASS;
45
+	private $_gatewayClass=self::DEFAULT_GATEWAY_CLASS;
46 46
 
47 47
 	private $_gateway;
48 48
 	private $_meta=array();
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @var TActiveRecordInvalidFinderResult
57 57
 	 * @since 3.1.5
58 58
 	 */
59
-	private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null;
59
+	private $_invalidFinderResult=TActiveRecordInvalidFinderResult::Null;
60 60
 
61 61
 	/**
62 62
 	 * @return ICache application cache.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		if($self!==null)
100 100
 			$instance=$self;
101 101
 		else if($instance===null)
102
-			$instance = new self;
102
+			$instance=new self;
103 103
 		return $instance;
104 104
 	}
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getRecordGateway()
110 110
 	{
111
-		if($this->_gateway === null) {
112
-			$this->_gateway = $this->createRecordGateway();
111
+		if($this->_gateway===null) {
112
+			$this->_gateway=$this->createRecordGateway();
113 113
 		}
114 114
 		return $this->_gateway;
115 115
 	}
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function setGatewayClass($value)
130 130
 	{
131
-		$this->_gateway = null;
132
-		$this->_gatewayClass = (string)$value;
131
+		$this->_gateway=null;
132
+		$this->_gatewayClass=(string) $value;
133 133
 	}
134 134
 
135 135
 	/**
@@ -158,6 +158,6 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function setInvalidFinderResult($value)
160 160
 	{
161
-		$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
161
+		$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
162 162
 	}
163 163
 }
Please login to merge, or discard this patch.