@@ -81,6 +81,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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) |
@@ -47,16 +47,16 @@ discard block |
||
47 | 47 | * internal data storage |
48 | 48 | * @var array |
49 | 49 | */ |
50 | - private $_d = []; |
|
50 | + private $_d=[]; |
|
51 | 51 | /** |
52 | 52 | * number of items |
53 | 53 | * @var integer |
54 | 54 | */ |
55 | - private $_c = 0; |
|
55 | + private $_c=0; |
|
56 | 56 | /** |
57 | 57 | * @var boolean whether this list is read-only |
58 | 58 | */ |
59 | - private $_r = false; |
|
59 | + private $_r=false; |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Constructor. |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | * @param boolean whether the list is read-only |
66 | 66 | * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator. |
67 | 67 | */ |
68 | - public function __construct($data = null, $readOnly = false) |
|
68 | + public function __construct($data=null, $readOnly=false) |
|
69 | 69 | { |
70 | - if($data !== null) |
|
70 | + if($data!==null) |
|
71 | 71 | $this->copyFrom($data); |
72 | 72 | $this->setReadOnly($readOnly); |
73 | 73 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | protected function setReadOnly($value) |
87 | 87 | { |
88 | - $this->_r = TPropertyValue::ensureBoolean($value); |
|
88 | + $this->_r=TPropertyValue::ensureBoolean($value); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | { |
157 | 157 | if(!$this->_r) |
158 | 158 | { |
159 | - if($index === $this->_c) |
|
160 | - $this->_d[$this->_c++] = $item; |
|
159 | + if($index===$this->_c) |
|
160 | + $this->_d[$this->_c++]=$item; |
|
161 | 161 | elseif($index >= 0 && $index < $this->_c) |
162 | 162 | { |
163 | 163 | array_splice($this->_d, $index, 0, [$item]); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | if(!$this->_r) |
185 | 185 | { |
186 | - if(($index = $this->indexOf($item)) >= 0) |
|
186 | + if(($index=$this->indexOf($item)) >= 0) |
|
187 | 187 | { |
188 | 188 | $this->removeAt($index); |
189 | 189 | return $index; |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | if($index >= 0 && $index < $this->_c) |
210 | 210 | { |
211 | 211 | $this->_c--; |
212 | - if($index === $this->_c) |
|
212 | + if($index===$this->_c) |
|
213 | 213 | return array_pop($this->_d); |
214 | 214 | else |
215 | 215 | { |
216 | - $item = $this->_d[$index]; |
|
216 | + $item=$this->_d[$index]; |
|
217 | 217 | array_splice($this->_d, $index, 1); |
218 | 218 | return $item; |
219 | 219 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function clear() |
233 | 233 | { |
234 | - for($i = $this->_c - 1;$i >= 0;--$i) |
|
234 | + for($i=$this->_c - 1; $i >= 0; --$i) |
|
235 | 235 | $this->removeAt($i); |
236 | 236 | } |
237 | 237 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function indexOf($item) |
252 | 252 | { |
253 | - if(($index = array_search($item, $this->_d, true)) === false) |
|
253 | + if(($index=array_search($item, $this->_d, true))===false) |
|
254 | 254 | return -1; |
255 | 255 | else |
256 | 256 | return $index; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | if(!$this->_r) |
271 | 271 | { |
272 | - if(($index = $this->indexOf($baseitem)) == -1) |
|
272 | + if(($index=$this->indexOf($baseitem))==-1) |
|
273 | 273 | throw new TInvalidDataValueException('list_item_inexistent'); |
274 | 274 | |
275 | 275 | $this->insertAt($index, $item); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | { |
294 | 294 | if(!$this->_r) |
295 | 295 | { |
296 | - if(($index = $this->indexOf($baseitem)) == -1) |
|
296 | + if(($index=$this->indexOf($baseitem))==-1) |
|
297 | 297 | throw new TInvalidDataValueException('list_item_inexistent'); |
298 | 298 | |
299 | 299 | $this->insertAt($index + 1, $item); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | foreach($data as $item) |
328 | 328 | $this->add($item); |
329 | 329 | } |
330 | - elseif($data !== null) |
|
330 | + elseif($data!==null) |
|
331 | 331 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
332 | 332 | } |
333 | 333 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | foreach($data as $item) |
345 | 345 | $this->add($item); |
346 | 346 | } |
347 | - elseif($data !== null) |
|
347 | + elseif($data!==null) |
|
348 | 348 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
349 | 349 | } |
350 | 350 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | public function offsetSet($offset, $item) |
381 | 381 | { |
382 | - if($offset === null || $offset === $this->_c) |
|
382 | + if($offset===null || $offset===$this->_c) |
|
383 | 383 | $this->insertAt($this->_c, $item); |
384 | 384 | else |
385 | 385 | { |
@@ -162,11 +162,9 @@ discard block |
||
162 | 162 | { |
163 | 163 | array_splice($this->_d, $index, 0, [$item]); |
164 | 164 | $this->_c++; |
165 | - } |
|
166 | - else |
|
165 | + } else |
|
167 | 166 | throw new TInvalidDataValueException('list_index_invalid', $index); |
168 | - } |
|
169 | - else |
|
167 | + } else |
|
170 | 168 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
171 | 169 | } |
172 | 170 | |
@@ -187,11 +185,9 @@ discard block |
||
187 | 185 | { |
188 | 186 | $this->removeAt($index); |
189 | 187 | return $index; |
190 | - } |
|
191 | - else |
|
188 | + } else |
|
192 | 189 | throw new TInvalidDataValueException('list_item_inexistent'); |
193 | - } |
|
194 | - else |
|
190 | + } else |
|
195 | 191 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
196 | 192 | } |
197 | 193 | |
@@ -217,11 +213,9 @@ discard block |
||
217 | 213 | array_splice($this->_d, $index, 1); |
218 | 214 | return $item; |
219 | 215 | } |
220 | - } |
|
221 | - else |
|
216 | + } else |
|
222 | 217 | throw new TInvalidDataValueException('list_index_invalid', $index); |
223 | - } |
|
224 | - else |
|
218 | + } else |
|
225 | 219 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
226 | 220 | } |
227 | 221 | |
@@ -275,8 +269,7 @@ discard block |
||
275 | 269 | $this->insertAt($index, $item); |
276 | 270 | |
277 | 271 | return $index; |
278 | - } |
|
279 | - else |
|
272 | + } else |
|
280 | 273 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
281 | 274 | } |
282 | 275 | |
@@ -299,8 +292,7 @@ discard block |
||
299 | 292 | $this->insertAt($index + 1, $item); |
300 | 293 | |
301 | 294 | return $index + 1; |
302 | - } |
|
303 | - else |
|
295 | + } else |
|
304 | 296 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
305 | 297 | } |
306 | 298 | |
@@ -326,8 +318,7 @@ discard block |
||
326 | 318 | $this->clear(); |
327 | 319 | foreach($data as $item) |
328 | 320 | $this->add($item); |
329 | - } |
|
330 | - elseif($data !== null) |
|
321 | + } elseif($data !== null) |
|
331 | 322 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
332 | 323 | } |
333 | 324 | |
@@ -343,8 +334,7 @@ discard block |
||
343 | 334 | { |
344 | 335 | foreach($data as $item) |
345 | 336 | $this->add($item); |
346 | - } |
|
347 | - elseif($data !== null) |
|
337 | + } elseif($data !== null) |
|
348 | 338 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
349 | 339 | } |
350 | 340 |
@@ -86,6 +86,7 @@ discard block |
||
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 |
||
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 | { |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * @var array internal data storage |
44 | 44 | */ |
45 | - private $_d = []; |
|
45 | + private $_d=[]; |
|
46 | 46 | /** |
47 | 47 | * @var boolean whether this list is read-only |
48 | 48 | */ |
49 | - private $_r = false; |
|
49 | + private $_r=false; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Returns an array with the names of all variables of this object that should NOT be serialized |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | protected function _getZappableSleepProps(&$exprops) |
58 | 58 | { |
59 | 59 | parent::_getZappableSleepProps($exprops); |
60 | - if ($this->_d === []) |
|
61 | - $exprops[] = "\0Prado\Collections\TMap\0_d"; |
|
62 | - if ($this->_r === false) |
|
63 | - $exprops[] = "\0Prado\Collections\TMap\0_r"; |
|
60 | + if($this->_d===[]) |
|
61 | + $exprops[]="\0Prado\Collections\TMap\0_d"; |
|
62 | + if($this->_r===false) |
|
63 | + $exprops[]="\0Prado\Collections\TMap\0_r"; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | * @param boolean whether the list is read-only |
71 | 71 | * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator. |
72 | 72 | */ |
73 | - public function __construct($data = null, $readOnly = false) |
|
73 | + public function __construct($data=null, $readOnly=false) |
|
74 | 74 | { |
75 | - if($data !== null) |
|
75 | + if($data!==null) |
|
76 | 76 | $this->copyFrom($data); |
77 | 77 | $this->setReadOnly($readOnly); |
78 | 78 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function setReadOnly($value) |
92 | 92 | { |
93 | - $this->_r = TPropertyValue::ensureBoolean($value); |
|
93 | + $this->_r=TPropertyValue::ensureBoolean($value); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function add($key, $value) |
151 | 151 | { |
152 | 152 | if(!$this->_r) |
153 | - $this->_d[$key] = $value; |
|
153 | + $this->_d[$key]=$value; |
|
154 | 154 | else |
155 | 155 | throw new TInvalidOperationException('map_readonly', get_class($this)); |
156 | 156 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | if(isset($this->_d[$key]) || array_key_exists($key, $this->_d)) |
169 | 169 | { |
170 | - $value = $this->_d[$key]; |
|
170 | + $value=$this->_d[$key]; |
|
171 | 171 | unset($this->_d[$key]); |
172 | 172 | return $value; |
173 | 173 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | foreach($data as $key => $value) |
220 | 220 | $this->add($key, $value); |
221 | 221 | } |
222 | - elseif($data !== null) |
|
222 | + elseif($data!==null) |
|
223 | 223 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
224 | 224 | } |
225 | 225 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | foreach($data as $key => $value) |
237 | 237 | $this->add($key, $value); |
238 | 238 | } |
239 | - elseif($data !== null) |
|
239 | + elseif($data!==null) |
|
240 | 240 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
241 | 241 | } |
242 | 242 |
@@ -170,11 +170,9 @@ discard block |
||
170 | 170 | $value = $this->_d[$key]; |
171 | 171 | unset($this->_d[$key]); |
172 | 172 | return $value; |
173 | - } |
|
174 | - else |
|
173 | + } else |
|
175 | 174 | return null; |
176 | - } |
|
177 | - else |
|
175 | + } else |
|
178 | 176 | throw new TInvalidOperationException('map_readonly', get_class($this)); |
179 | 177 | } |
180 | 178 | |
@@ -218,8 +216,7 @@ discard block |
||
218 | 216 | $this->clear(); |
219 | 217 | foreach($data as $key => $value) |
220 | 218 | $this->add($key, $value); |
221 | - } |
|
222 | - elseif($data !== null) |
|
219 | + } elseif($data !== null) |
|
223 | 220 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
224 | 221 | } |
225 | 222 | |
@@ -235,8 +232,7 @@ discard block |
||
235 | 232 | { |
236 | 233 | foreach($data as $key => $value) |
237 | 234 | $this->add($key, $value); |
238 | - } |
|
239 | - elseif($data !== null) |
|
235 | + } elseif($data !== null) |
|
240 | 236 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
241 | 237 | } |
242 | 238 |
@@ -68,6 +68,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | { |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @var integer number of items in each page |
43 | 43 | */ |
44 | - private $_pageSize = 10; |
|
44 | + private $_pageSize=10; |
|
45 | 45 | /** |
46 | 46 | * @var integer current page index |
47 | 47 | */ |
48 | - private $_currentPageIndex = 0; |
|
48 | + private $_currentPageIndex=0; |
|
49 | 49 | /** |
50 | 50 | * @var boolean whether to allow paging |
51 | 51 | */ |
52 | - private $_allowPaging = false; |
|
52 | + private $_allowPaging=false; |
|
53 | 53 | /** |
54 | 54 | * @var boolean whether to allow custom paging |
55 | 55 | */ |
56 | - private $_allowCustomPaging = false; |
|
56 | + private $_allowCustomPaging=false; |
|
57 | 57 | /** |
58 | 58 | * @var integer user-assigned number of items in data source |
59 | 59 | */ |
60 | - private $_virtualCount = 0; |
|
60 | + private $_virtualCount=0; |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @return mixed original data source. Defaults to null. |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | if(!($value instanceof TMap) && !($value instanceof TList)) |
76 | 76 | { |
77 | 77 | if(is_array($value)) |
78 | - $value = new TMap($value); |
|
78 | + $value=new TMap($value); |
|
79 | 79 | elseif($value instanceof \Traversable) |
80 | - $value = new TList($value); |
|
81 | - elseif($value !== null) |
|
80 | + $value=new TList($value); |
|
81 | + elseif($value!==null) |
|
82 | 82 | throw new TInvalidDataTypeException('pageddatasource_datasource_invalid'); |
83 | 83 | } |
84 | - $this->_dataSource = $value; |
|
84 | + $this->_dataSource=$value; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function setPageSize($value) |
99 | 99 | { |
100 | - if(($value = TPropertyValue::ensureInteger($value)) > 0) |
|
101 | - $this->_pageSize = $value; |
|
100 | + if(($value=TPropertyValue::ensureInteger($value)) > 0) |
|
101 | + $this->_pageSize=$value; |
|
102 | 102 | else |
103 | 103 | throw new TInvalidDataValueException('pageddatasource_pagesize_invalid'); |
104 | 104 | } |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function setCurrentPageIndex($value) |
118 | 118 | { |
119 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
120 | - $value = 0; |
|
121 | - $this->_currentPageIndex = $value; |
|
119 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
120 | + $value=0; |
|
121 | + $this->_currentPageIndex=$value; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function setAllowPaging($value) |
136 | 136 | { |
137 | - $this->_allowPaging = TPropertyValue::ensureBoolean($value); |
|
137 | + $this->_allowPaging=TPropertyValue::ensureBoolean($value); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function setAllowCustomPaging($value) |
152 | 152 | { |
153 | - $this->_allowCustomPaging = TPropertyValue::ensureBoolean($value); |
|
153 | + $this->_allowCustomPaging=TPropertyValue::ensureBoolean($value); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function setVirtualItemCount($value) |
168 | 168 | { |
169 | - if(($value = TPropertyValue::ensureInteger($value)) >= 0) |
|
170 | - $this->_virtualCount = $value; |
|
169 | + if(($value=TPropertyValue::ensureInteger($value)) >= 0) |
|
170 | + $this->_virtualCount=$value; |
|
171 | 171 | else |
172 | 172 | throw new TInvalidDataValueException('pageddatasource_virtualitemcount_invalid'); |
173 | 173 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function getCount() |
179 | 179 | { |
180 | - if($this->_dataSource === null) |
|
180 | + if($this->_dataSource===null) |
|
181 | 181 | return 0; |
182 | 182 | if(!$this->_allowPaging) |
183 | 183 | return $this->getDataSourceCount(); |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getPageCount() |
203 | 203 | { |
204 | - if($this->_dataSource === null) |
|
204 | + if($this->_dataSource===null) |
|
205 | 205 | return 0; |
206 | - $count = $this->getDataSourceCount(); |
|
206 | + $count=$this->getDataSourceCount(); |
|
207 | 207 | if(!$this->_allowPaging || $count <= 0) |
208 | 208 | return 1; |
209 | - return (int)(($count + $this->_pageSize - 1) / $this->_pageSize); |
|
209 | + return (int) (($count + $this->_pageSize - 1) / $this->_pageSize); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | public function getIsFirstPage() |
216 | 216 | { |
217 | 217 | if($this->_allowPaging) |
218 | - return $this->_currentPageIndex === 0; |
|
218 | + return $this->_currentPageIndex===0; |
|
219 | 219 | else |
220 | 220 | return true; |
221 | 221 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | public function getIsLastPage() |
227 | 227 | { |
228 | 228 | if($this->_allowPaging) |
229 | - return $this->_currentPageIndex === $this->getPageCount() - 1; |
|
229 | + return $this->_currentPageIndex===$this->getPageCount() - 1; |
|
230 | 230 | else |
231 | 231 | return true; |
232 | 232 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function getFirstIndexInPage() |
239 | 239 | { |
240 | - if($this->_dataSource !== null && $this->_allowPaging && !$this->_allowCustomPaging) |
|
240 | + if($this->_dataSource!==null && $this->_allowPaging && !$this->_allowCustomPaging) |
|
241 | 241 | return $this->_currentPageIndex * $this->_pageSize; |
242 | 242 | else |
243 | 243 | return 0; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | public function getDataSourceCount() |
250 | 250 | { |
251 | - if($this->_dataSource === null) |
|
251 | + if($this->_dataSource===null) |
|
252 | 252 | return 0; |
253 | 253 | elseif($this->_allowCustomPaging) |
254 | 254 | return $this->_virtualCount; |
@@ -28,6 +28,7 @@ |
||
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 | { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function __construct($oldPage) |
33 | 33 | { |
34 | - $this->_oldPage = $oldPage; |
|
34 | + $this->_oldPage=$oldPage; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -143,6 +143,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | */ |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | /** |
58 | 58 | * @var array internal data storage |
59 | 59 | */ |
60 | - private $_d = []; |
|
60 | + private $_d=[]; |
|
61 | 61 | /** |
62 | 62 | * @var boolean indicates if the _d is currently ordered. |
63 | 63 | */ |
64 | - private $_o = false; |
|
64 | + private $_o=false; |
|
65 | 65 | /** |
66 | 66 | * @var array cached flattened internal data storage |
67 | 67 | */ |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @var integer number of items contain within the list |
71 | 71 | */ |
72 | - private $_c = 0; |
|
72 | + private $_c=0; |
|
73 | 73 | /** |
74 | 74 | * @var numeric the default priority of items without specified priorities |
75 | 75 | */ |
76 | - private $_dp = 10; |
|
76 | + private $_dp=10; |
|
77 | 77 | /** |
78 | 78 | * @var integer the precision of the numeric priorities within this priority list. |
79 | 79 | */ |
80 | - private $_p = 8; |
|
80 | + private $_p=8; |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Constructor. |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @param integer the precision of the numeric priorities |
89 | 89 | * @throws TInvalidDataTypeException If data is not null and is neither an array nor an iterator. |
90 | 90 | */ |
91 | - public function __construct($data = null, $readOnly = false, $defaultPriority = 10, $precision = 8) |
|
91 | + public function __construct($data=null, $readOnly=false, $defaultPriority=10, $precision=8) |
|
92 | 92 | { |
93 | 93 | parent::__construct(); |
94 | - if($data !== null) |
|
94 | + if($data!==null) |
|
95 | 95 | $this->copyFrom($data); |
96 | 96 | $this->setReadOnly($readOnly); |
97 | 97 | $this->setPrecision($precision); |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | * @param numeric optional priority at which to count items. if no parameter, it will be set to the default {@link getDefaultPriority} |
123 | 123 | * @return integer the number of items in the list at the specified priority |
124 | 124 | */ |
125 | - public function getPriorityCount($priority = null) |
|
125 | + public function getPriorityCount($priority=null) |
|
126 | 126 | { |
127 | - if($priority === null) |
|
128 | - $priority = $this->getDefaultPriority(); |
|
129 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
127 | + if($priority===null) |
|
128 | + $priority=$this->getDefaultPriority(); |
|
129 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
130 | 130 | |
131 | 131 | if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority])) |
132 | 132 | return false; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function setDefaultPriority($value) |
149 | 149 | { |
150 | - $this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p); |
|
150 | + $this->_dp=(string) round(TPropertyValue::ensureFloat($value), $this->_p); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | protected function setPrecision($value) |
166 | 166 | { |
167 | - $this->_p = TPropertyValue::ensureInteger($value); |
|
167 | + $this->_p=TPropertyValue::ensureInteger($value); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | protected function sortPriorities() { |
195 | 195 | if(!$this->_o) { |
196 | 196 | ksort($this->_d, SORT_NUMERIC); |
197 | - $this->_o = true; |
|
197 | + $this->_o=true; |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | return $this->_fd; |
208 | 208 | |
209 | 209 | $this->sortPriorities(); |
210 | - $this->_fd = []; |
|
210 | + $this->_fd=[]; |
|
211 | 211 | foreach($this->_d as $priority => $itemsatpriority) |
212 | - $this->_fd = array_merge($this->_fd, $itemsatpriority); |
|
212 | + $this->_fd=array_merge($this->_fd, $itemsatpriority); |
|
213 | 213 | return $this->_fd; |
214 | 214 | } |
215 | 215 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | public function itemAt($index) |
225 | 225 | { |
226 | 226 | if($index >= 0 && $index < $this->getCount()) { |
227 | - $arr = $this->flattenPriorities(); |
|
227 | + $arr=$this->flattenPriorities(); |
|
228 | 228 | return $arr[$index]; |
229 | 229 | } else |
230 | 230 | throw new TInvalidDataValueException('list_index_invalid', $index); |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | * @param numeric priority of the items to get. Defaults to null, filled in with the default priority, if left blank. |
236 | 236 | * @return array all items at priority in index order, null if there are no items at that priority |
237 | 237 | */ |
238 | - public function itemsAtPriority($priority = null) |
|
238 | + public function itemsAtPriority($priority=null) |
|
239 | 239 | { |
240 | - if($priority === null) |
|
241 | - $priority = $this->getDefaultPriority(); |
|
242 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
240 | + if($priority===null) |
|
241 | + $priority=$this->getDefaultPriority(); |
|
242 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
243 | 243 | |
244 | - return isset($this->_d[$priority])?$this->_d[$priority]:null; |
|
244 | + return isset($this->_d[$priority]) ? $this->_d[$priority] : null; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | * @param numeric the priority which to index. no parameter or null will result in the default priority |
251 | 251 | * @return mixed the element at the offset, false if no element is found at the offset |
252 | 252 | */ |
253 | - public function itemAtIndexInPriority($index, $priority = null) |
|
253 | + public function itemAtIndexInPriority($index, $priority=null) |
|
254 | 254 | { |
255 | - if($priority === null) |
|
256 | - $priority = $this->getDefaultPriority(); |
|
257 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
255 | + if($priority===null) |
|
256 | + $priority=$this->getDefaultPriority(); |
|
257 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
258 | 258 | |
259 | - return !isset($this->_d[$priority])?false:( |
|
260 | - isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false |
|
259 | + return !isset($this->_d[$priority]) ?false:( |
|
260 | + isset($this->_d[$priority][$index]) ? $this->_d[$priority][$index] : false |
|
261 | 261 | ); |
262 | 262 | } |
263 | 263 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @return int the index within the flattened array |
270 | 270 | * @throws TInvalidOperationException if the map is read-only |
271 | 271 | */ |
272 | - public function add($item, $priority = null) |
|
272 | + public function add($item, $priority=null) |
|
273 | 273 | { |
274 | 274 | if($this->getReadOnly()) |
275 | 275 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | if($this->getReadOnly()) |
291 | 291 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
292 | 292 | |
293 | - if(($priority = $this->priorityAt($index, true)) !== false) |
|
293 | + if(($priority=$this->priorityAt($index, true))!==false) |
|
294 | 294 | $this->insertAtIndexInPriority($item, $priority[1], $priority[0]); |
295 | 295 | else |
296 | 296 | throw new TInvalidDataValueException('list_index_invalid', $index); |
@@ -306,56 +306,56 @@ discard block |
||
306 | 306 | * @throws TInvalidDataValueException If the index specified exceeds the bound |
307 | 307 | * @throws TInvalidOperationException if the list is read-only |
308 | 308 | */ |
309 | - public function insertAtIndexInPriority($item, $index = false, $priority = null, $preserveCache = false) |
|
309 | + public function insertAtIndexInPriority($item, $index=false, $priority=null, $preserveCache=false) |
|
310 | 310 | { |
311 | 311 | if($this->getReadOnly()) |
312 | 312 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
313 | 313 | |
314 | - if($priority === null) |
|
315 | - $priority = $this->getDefaultPriority(); |
|
316 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
314 | + if($priority===null) |
|
315 | + $priority=$this->getDefaultPriority(); |
|
316 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
317 | 317 | |
318 | 318 | if($preserveCache) { |
319 | 319 | $this->sortPriorities(); |
320 | - $cc = 0; |
|
320 | + $cc=0; |
|
321 | 321 | foreach($this->_d as $prioritykey => $items) |
322 | 322 | if($prioritykey >= $priority) |
323 | 323 | break; |
324 | 324 | else |
325 | - $cc += count($items); |
|
325 | + $cc+=count($items); |
|
326 | 326 | |
327 | - if($index === false && isset($this->_d[$priority])) { |
|
328 | - $c = count($this->_d[$priority]); |
|
329 | - $c += $cc; |
|
330 | - $this->_d[$priority][] = $item; |
|
327 | + if($index===false && isset($this->_d[$priority])) { |
|
328 | + $c=count($this->_d[$priority]); |
|
329 | + $c+=$cc; |
|
330 | + $this->_d[$priority][]=$item; |
|
331 | 331 | } elseif(isset($this->_d[$priority])) { |
332 | - $c = $index + $cc; |
|
332 | + $c=$index + $cc; |
|
333 | 333 | array_splice($this->_d[$priority], $index, 0, [$item]); |
334 | 334 | } else { |
335 | - $c = $cc; |
|
336 | - $this->_o = false; |
|
337 | - $this->_d[$priority] = [$item]; |
|
335 | + $c=$cc; |
|
336 | + $this->_o=false; |
|
337 | + $this->_d[$priority]=[$item]; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | if($this->_fd && is_array($this->_fd)) // if there is a flattened array cache |
341 | 341 | array_splice($this->_fd, $c, 0, [$item]); |
342 | 342 | } else { |
343 | - $c = null; |
|
344 | - if($index === false && isset($this->_d[$priority])) { |
|
345 | - $cc = count($this->_d[$priority]); |
|
346 | - $this->_d[$priority][] = $item; |
|
343 | + $c=null; |
|
344 | + if($index===false && isset($this->_d[$priority])) { |
|
345 | + $cc=count($this->_d[$priority]); |
|
346 | + $this->_d[$priority][]=$item; |
|
347 | 347 | } elseif(isset($this->_d[$priority])) { |
348 | - $cc = $index; |
|
348 | + $cc=$index; |
|
349 | 349 | array_splice($this->_d[$priority], $index, 0, [$item]); |
350 | 350 | } else { |
351 | - $cc = 0; |
|
352 | - $this->_o = false; |
|
353 | - $this->_d[$priority] = [$item]; |
|
351 | + $cc=0; |
|
352 | + $this->_o=false; |
|
353 | + $this->_d[$priority]=[$item]; |
|
354 | 354 | } |
355 | - if($this->_fd && is_array($this->_fd) && count($this->_d) == 1) |
|
355 | + if($this->_fd && is_array($this->_fd) && count($this->_d)==1) |
|
356 | 356 | array_splice($this->_fd, $cc, 0, [$item]); |
357 | 357 | else |
358 | - $this->_fd = null; |
|
358 | + $this->_fd=null; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | $this->_c++; |
@@ -374,19 +374,19 @@ discard block |
||
374 | 374 | * @return integer index within the flattened list at which the item is being removed |
375 | 375 | * @throws TInvalidDataValueException If the item does not exist |
376 | 376 | */ |
377 | - public function remove($item, $priority = false) |
|
377 | + public function remove($item, $priority=false) |
|
378 | 378 | { |
379 | 379 | if($this->getReadOnly()) |
380 | 380 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
381 | 381 | |
382 | - if(($p = $this->priorityOf($item, true)) !== false) |
|
382 | + if(($p=$this->priorityOf($item, true))!==false) |
|
383 | 383 | { |
384 | - if($priority !== false) { |
|
385 | - if($priority === null) |
|
386 | - $priority = $this->getDefaultPriority(); |
|
387 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
384 | + if($priority!==false) { |
|
385 | + if($priority===null) |
|
386 | + $priority=$this->getDefaultPriority(); |
|
387 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
388 | 388 | |
389 | - if($p[0] != $priority) |
|
389 | + if($p[0]!=$priority) |
|
390 | 390 | throw new TInvalidDataValueException('list_item_inexistent'); |
391 | 391 | } |
392 | 392 | $this->removeAtIndexInPriority($p[1], $p[0]); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | if($this->getReadOnly()) |
409 | 409 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
410 | 410 | |
411 | - if(($priority = $this->priorityAt($index, true)) !== false) |
|
411 | + if(($priority=$this->priorityAt($index, true))!==false) |
|
412 | 412 | return $this->removeAtIndexInPriority($priority[1], $priority[0]); |
413 | 413 | throw new TInvalidDataValueException('list_index_invalid', $index); |
414 | 414 | } |
@@ -421,27 +421,27 @@ discard block |
||
421 | 421 | * @return mixed the removed item. |
422 | 422 | * @throws TInvalidDataValueException If the item does not exist |
423 | 423 | */ |
424 | - public function removeAtIndexInPriority($index, $priority = null) |
|
424 | + public function removeAtIndexInPriority($index, $priority=null) |
|
425 | 425 | { |
426 | 426 | if($this->getReadOnly()) |
427 | 427 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
428 | 428 | |
429 | - if($priority === null) |
|
430 | - $priority = $this->getDefaultPriority(); |
|
431 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
429 | + if($priority===null) |
|
430 | + $priority=$this->getDefaultPriority(); |
|
431 | + $priority=(string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
432 | 432 | |
433 | 433 | if(!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority])) |
434 | 434 | throw new TInvalidDataValueException('list_item_inexistent'); |
435 | 435 | |
436 | 436 | // $value is an array of elements removed, only one |
437 | - $value = array_splice($this->_d[$priority], $index, 1); |
|
438 | - $value = $value[0]; |
|
437 | + $value=array_splice($this->_d[$priority], $index, 1); |
|
438 | + $value=$value[0]; |
|
439 | 439 | |
440 | 440 | if(!count($this->_d[$priority])) |
441 | 441 | unset($this->_d[$priority]); |
442 | 442 | |
443 | 443 | $this->_c--; |
444 | - $this->_fd = null; |
|
444 | + $this->_fd=null; |
|
445 | 445 | return $value; |
446 | 446 | } |
447 | 447 | |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
455 | 455 | |
456 | 456 | foreach($this->_d as $priority => $items) { |
457 | - for($index = count($items) - 1;$index >= 0;$index--) |
|
457 | + for($index=count($items) - 1; $index >= 0; $index--) |
|
458 | 458 | $this->removeAtIndexInPriority($index, $priority); |
459 | 459 | unset($this->_d[$priority]); |
460 | 460 | } |
@@ -475,7 +475,7 @@ discard block |
||
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,18 +490,18 @@ discard block |
||
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) { |
|
500 | - $absindex += $index; |
|
501 | - return $withindex?[$priority,$index,$absindex, |
|
502 | - 'priority' => $priority,'index' => $index,'absindex' => $absindex]:$priority; |
|
499 | + if(($index=array_search($item, $items, true))!==false) { |
|
500 | + $absindex+=$index; |
|
501 | + return $withindex ? [$priority, $index, $absindex, |
|
502 | + 'priority' => $priority, 'index' => $index, 'absindex' => $absindex] : $priority; |
|
503 | 503 | } else |
504 | - $absindex += count($items); |
|
504 | + $absindex+=count($items); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | return false; |
@@ -516,19 +516,19 @@ discard block |
||
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 | 521 | if($index < 0 || $index >= $this->getCount()) |
522 | 522 | throw new TInvalidDataValueException('list_index_invalid', $index); |
523 | 523 | |
524 | - $absindex = $index; |
|
524 | + $absindex=$index; |
|
525 | 525 | $this->sortPriorities(); |
526 | 526 | foreach($this->_d as $priority => $items) { |
527 | - if($index >= ($c = count($items))) |
|
528 | - $index -= $c; |
|
527 | + if($index >= ($c=count($items))) |
|
528 | + $index-=$c; |
|
529 | 529 | else |
530 | - return $withindex?[$priority,$index,$absindex, |
|
531 | - 'priority' => $priority,'index' => $index,'absindex' => $absindex]:$priority; |
|
530 | + return $withindex ? [$priority, $index, $absindex, |
|
531 | + 'priority' => $priority, 'index' => $index, 'absindex' => $absindex] : $priority; |
|
532 | 532 | } |
533 | 533 | return false; |
534 | 534 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | if($this->getReadOnly()) |
547 | 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 | 552 | $this->insertAtIndexInPriority($item, $priority[1], $priority[0]); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | if($this->getReadOnly()) |
568 | 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 | 573 | $this->insertAtIndexInPriority($item, $priority[1] + 1, $priority[0]); |
@@ -599,15 +599,15 @@ discard block |
||
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 | - $items = []; |
|
605 | + $items=[]; |
|
606 | 606 | foreach($this->_d as $itemspriority => $itemsatpriority) |
607 | 607 | { |
608 | 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 |
||
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 | - $items = []; |
|
625 | + $items=[]; |
|
626 | 626 | foreach($this->_d as $itemspriority => $itemsatpriority) |
627 | 627 | { |
628 | 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 | } |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | $this->clear(); |
656 | 656 | foreach($data as $key => $item) |
657 | 657 | $this->add($item); |
658 | - } elseif($data !== null) |
|
658 | + } elseif($data!==null) |
|
659 | 659 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
660 | 660 | } |
661 | 661 | |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | $this->add($item); |
684 | 684 | |
685 | 685 | } |
686 | - elseif($data !== null) |
|
686 | + elseif($data!==null) |
|
687 | 687 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
688 | 688 | } |
689 | 689 | |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | */ |
724 | 724 | public function offsetSet($offset, $item) |
725 | 725 | { |
726 | - if($offset === null) |
|
726 | + if($offset===null) |
|
727 | 727 | return $this->add($item); |
728 | - if($offset === $this->getCount()) { |
|
729 | - $priority = $this->priorityAt($offset - 1, true); |
|
728 | + if($offset===$this->getCount()) { |
|
729 | + $priority=$this->priorityAt($offset - 1, true); |
|
730 | 730 | $priority[1]++; |
731 | 731 | } else { |
732 | - $priority = $this->priorityAt($offset, true); |
|
732 | + $priority=$this->priorityAt($offset, true); |
|
733 | 733 | $this->removeAtIndexInPriority($priority[1], $priority[0]); |
734 | 734 | } |
735 | 735 | $this->insertAtIndexInPriority($item, $priority[1], $priority[0]); |
@@ -391,8 +391,7 @@ discard block |
||
391 | 391 | } |
392 | 392 | $this->removeAtIndexInPriority($p[1], $p[0]); |
393 | 393 | return $p[2]; |
394 | - } |
|
395 | - else |
|
394 | + } else |
|
396 | 395 | throw new TInvalidDataValueException('list_item_inexistent'); |
397 | 396 | } |
398 | 397 | |
@@ -676,14 +675,12 @@ discard block |
||
676 | 675 | foreach($data->itemsAtPriority($priority) as $index => $item) |
677 | 676 | $this->insertAtIndexInPriority($item, false, $priority); |
678 | 677 | } |
679 | - } |
|
680 | - elseif(is_array($data) || $data instanceof \Traversable) |
|
678 | + } elseif(is_array($data) || $data instanceof \Traversable) |
|
681 | 679 | { |
682 | 680 | foreach($data as $priority => $item) |
683 | 681 | $this->add($item); |
684 | 682 | |
685 | - } |
|
686 | - elseif($data !== null) |
|
683 | + } elseif($data !== null) |
|
687 | 684 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
688 | 685 | } |
689 | 686 |
@@ -149,7 +149,7 @@ |
||
149 | 149 | /** |
150 | 150 | * Returns an iterator for traversing the items in the queue. |
151 | 151 | * This method is required by the interface \IteratorAggregate. |
152 | - * @return Iterator an iterator for traversing the items in the queue. |
|
152 | + * @return \ArrayIterator an iterator for traversing the items in the queue. |
|
153 | 153 | */ |
154 | 154 | public function getIterator() |
155 | 155 | { |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | * internal data storage |
42 | 42 | * @var array |
43 | 43 | */ |
44 | - private $_d = []; |
|
44 | + private $_d=[]; |
|
45 | 45 | /** |
46 | 46 | * number of items |
47 | 47 | * @var integer |
48 | 48 | */ |
49 | - private $_c = 0; |
|
49 | + private $_c=0; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Constructor. |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @param array|Iterator the intial data. Default is null, meaning no initialization. |
55 | 55 | * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator. |
56 | 56 | */ |
57 | - public function __construct($data = null) |
|
57 | + public function __construct($data=null) |
|
58 | 58 | { |
59 | - if($data !== null) |
|
59 | + if($data!==null) |
|
60 | 60 | $this->copyFrom($data); |
61 | 61 | } |
62 | 62 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | $this->clear(); |
82 | 82 | foreach($data as $item) |
83 | 83 | { |
84 | - $this->_d[] = $item; |
|
84 | + $this->_d[]=$item; |
|
85 | 85 | ++$this->_c; |
86 | 86 | } |
87 | 87 | } |
88 | - elseif($data !== null) |
|
88 | + elseif($data!==null) |
|
89 | 89 | throw new TInvalidDataTypeException('queue_data_not_iterable'); |
90 | 90 | } |
91 | 91 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function clear() |
96 | 96 | { |
97 | - $this->_c = 0; |
|
98 | - $this->_d = []; |
|
97 | + $this->_c=0; |
|
98 | + $this->_d=[]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function contains($item) |
106 | 106 | { |
107 | - return array_search($item, $this->_d, true) !== false; |
|
107 | + return array_search($item, $this->_d, true)!==false; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function peek() |
117 | 117 | { |
118 | - if($this->_c === 0) |
|
118 | + if($this->_c===0) |
|
119 | 119 | throw new TInvalidOperationException('queue_empty'); |
120 | 120 | else |
121 | 121 | return $this->_d[0]; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function dequeue() |
130 | 130 | { |
131 | - if($this->_c === 0) |
|
131 | + if($this->_c===0) |
|
132 | 132 | throw new TInvalidOperationException('queue_empty'); |
133 | 133 | else |
134 | 134 | { |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function enqueue($item) |
145 | 145 | { |
146 | 146 | ++$this->_c; |
147 | - $this->_d[] = $item; |
|
147 | + $this->_d[]=$item; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -84,8 +84,7 @@ |
||
84 | 84 | $this->_d[] = $item; |
85 | 85 | ++$this->_c; |
86 | 86 | } |
87 | - } |
|
88 | - elseif($data !== null) |
|
87 | + } elseif($data !== null) |
|
89 | 88 | throw new TInvalidDataTypeException('queue_data_not_iterable'); |
90 | 89 | } |
91 | 90 |
@@ -148,7 +148,7 @@ |
||
148 | 148 | /** |
149 | 149 | * Returns an iterator for traversing the items in the stack. |
150 | 150 | * This method is required by the interface \IteratorAggregate. |
151 | - * @return Iterator an iterator for traversing the items in the stack. |
|
151 | + * @return \ArrayIterator an iterator for traversing the items in the stack. |
|
152 | 152 | */ |
153 | 153 | public function getIterator() |
154 | 154 | { |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * internal data storage |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - private $_d = []; |
|
43 | + private $_d=[]; |
|
44 | 44 | /** |
45 | 45 | * number of items |
46 | 46 | * @var integer |
47 | 47 | */ |
48 | - private $_c = 0; |
|
48 | + private $_c=0; |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Constructor. |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param array|Iterator the initial data. Default is null, meaning no initialization. |
54 | 54 | * @throws TInvalidDataTypeException If data is not null and neither an array nor an iterator. |
55 | 55 | */ |
56 | - public function __construct($data = null) |
|
56 | + public function __construct($data=null) |
|
57 | 57 | { |
58 | - if($data !== null) |
|
58 | + if($data!==null) |
|
59 | 59 | $this->copyFrom($data); |
60 | 60 | } |
61 | 61 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $this->clear(); |
81 | 81 | foreach($data as $item) |
82 | 82 | { |
83 | - $this->_d[] = $item; |
|
83 | + $this->_d[]=$item; |
|
84 | 84 | ++$this->_c; |
85 | 85 | } |
86 | 86 | } |
87 | - elseif($data !== null) |
|
87 | + elseif($data!==null) |
|
88 | 88 | throw new TInvalidDataTypeException('stack_data_not_iterable'); |
89 | 89 | } |
90 | 90 | |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function clear() |
95 | 95 | { |
96 | - $this->_c = 0; |
|
97 | - $this->_d = []; |
|
96 | + $this->_c=0; |
|
97 | + $this->_d=[]; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function contains($item) |
105 | 105 | { |
106 | - return array_search($item, $this->_d, true) !== false; |
|
106 | + return array_search($item, $this->_d, true)!==false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function peek() |
116 | 116 | { |
117 | - if($this->_c === 0) |
|
117 | + if($this->_c===0) |
|
118 | 118 | throw new TInvalidOperationException('stack_empty'); |
119 | 119 | else |
120 | 120 | return $this->_d[$this->_c - 1]; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function pop() |
129 | 129 | { |
130 | - if($this->_c === 0) |
|
130 | + if($this->_c===0) |
|
131 | 131 | throw new TInvalidOperationException('stack_empty'); |
132 | 132 | else |
133 | 133 | { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function push($item) |
144 | 144 | { |
145 | 145 | ++$this->_c; |
146 | - $this->_d[] = $item; |
|
146 | + $this->_d[]=$item; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -83,8 +83,7 @@ |
||
83 | 83 | $this->_d[] = $item; |
84 | 84 | ++$this->_c; |
85 | 85 | } |
86 | - } |
|
87 | - elseif($data !== null) |
|
86 | + } elseif($data !== null) |
|
88 | 87 | throw new TInvalidDataTypeException('stack_data_not_iterable'); |
89 | 88 | } |
90 | 89 |
@@ -28,6 +28,7 @@ |
||
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 |
@@ -91,6 +91,7 @@ discard block |
||
91 | 91 | /** |
92 | 92 | * Name of the Active Record class to be viewed or scaffolded. |
93 | 93 | * @param string Active Record class name. |
94 | + * @param string $value |
|
94 | 95 | */ |
95 | 96 | public function setRecordClass($value) |
96 | 97 | { |
@@ -190,6 +191,7 @@ discard block |
||
190 | 191 | |
191 | 192 | /** |
192 | 193 | * @param boolean enable default stylesheet, default is true. |
194 | + * @param boolean $value |
|
193 | 195 | */ |
194 | 196 | public function setEnableDefaultStyle($value) |
195 | 197 | { |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function getTableInfo() |
49 | 49 | { |
50 | - $finder = $this->getRecordFinder(); |
|
51 | - $gateway = $finder->getRecordManager()->getRecordGateWay(); |
|
50 | + $finder=$this->getRecordFinder(); |
|
51 | + $gateway=$finder->getRecordManager()->getRecordGateWay(); |
|
52 | 52 | return $gateway->getRecordTableInfo($finder); |
53 | 53 | } |
54 | 54 | |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | */ |
59 | 59 | protected function getRecordPropertyValues($record) |
60 | 60 | { |
61 | - $data = []; |
|
61 | + $data=[]; |
|
62 | 62 | foreach($this->getTableInfo()->getColumns() as $name => $column) |
63 | - $data[] = $record->getColumnValue($name); |
|
63 | + $data[]=$record->getColumnValue($name); |
|
64 | 64 | return $data; |
65 | 65 | } |
66 | 66 | |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | protected function getRecordPkValues($record) |
72 | 72 | { |
73 | - $data = []; |
|
73 | + $data=[]; |
|
74 | 74 | foreach($this->getTableInfo()->getColumns() as $name => $column) |
75 | 75 | { |
76 | 76 | if($column->getIsPrimaryKey()) |
77 | - $data[] = $record->getColumnValue($name); |
|
77 | + $data[]=$record->getColumnValue($name); |
|
78 | 78 | } |
79 | 79 | return $data; |
80 | 80 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function copyFrom(TScaffoldBase $obj) |
105 | 105 | { |
106 | - $this->_record = $obj->_record; |
|
106 | + $this->_record=$obj->_record; |
|
107 | 107 | $this->setRecordClass($obj->getRecordClass()); |
108 | 108 | $this->setEnableDefaultStyle($obj->getEnableDefaultStyle()); |
109 | 109 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function clearRecordObject() |
115 | 115 | { |
116 | - $this->_record = null; |
|
116 | + $this->_record=null; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -122,22 +122,22 @@ discard block |
||
122 | 122 | * @param array primary key value |
123 | 123 | * @return TActiveRecord record instance |
124 | 124 | */ |
125 | - protected function getRecordObject($pk = null) |
|
125 | + protected function getRecordObject($pk=null) |
|
126 | 126 | { |
127 | - if($this->_record === null) |
|
127 | + if($this->_record===null) |
|
128 | 128 | { |
129 | - if($pk !== null) |
|
129 | + if($pk!==null) |
|
130 | 130 | { |
131 | - $this->_record = $this->getRecordFinder()->findByPk($pk); |
|
132 | - if($this->_record === null) |
|
131 | + $this->_record=$this->getRecordFinder()->findByPk($pk); |
|
132 | + if($this->_record===null) |
|
133 | 133 | throw new TConfigurationException('scaffold_invalid_record_pk', |
134 | 134 | $this->getRecordClass(), $pk); |
135 | 135 | } |
136 | 136 | else |
137 | 137 | { |
138 | - $class = $this->getRecordClass(); |
|
139 | - if($class !== null) |
|
140 | - $this->_record = Prado::createComponent($class); |
|
138 | + $class=$this->getRecordClass(); |
|
139 | + if($class!==null) |
|
140 | + $this->_record=Prado::createComponent($class); |
|
141 | 141 | else |
142 | 142 | { |
143 | 143 | throw new TConfigurationException('scaffold_invalid_record_class', |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function setRecordObject(TActiveRecord $value) |
155 | 155 | { |
156 | - $this->_record = $value; |
|
156 | + $this->_record=$value; |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | parent::onPreRender($param); |
205 | 205 | if($this->getEnableDefaultStyle()) |
206 | 206 | { |
207 | - $url = $this->publishAsset($this->getDefaultStyle() . '.css'); |
|
207 | + $url=$this->publishAsset($this->getDefaultStyle().'.css'); |
|
208 | 208 | $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
209 | 209 | } |
210 | 210 | } |
@@ -132,8 +132,7 @@ |
||
132 | 132 | if($this->_record === null) |
133 | 133 | throw new TConfigurationException('scaffold_invalid_record_pk', |
134 | 134 | $this->getRecordClass(), $pk); |
135 | - } |
|
136 | - else |
|
135 | + } else |
|
137 | 136 | { |
138 | 137 | $class = $this->getRecordClass(); |
139 | 138 | if($class !== null) |