@@ -206,7 +206,7 @@ |
||
206 | 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 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | if($priority === null) |
128 | 128 | $priority = $this->getDefaultPriority(); |
129 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
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 | /** |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | { |
240 | 240 | if($priority === null) |
241 | 241 | $priority = $this->getDefaultPriority(); |
242 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
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 | /** |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | { |
255 | 255 | if($priority === null) |
256 | 256 | $priority = $this->getDefaultPriority(); |
257 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
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 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | if($priority === null) |
315 | 315 | $priority = $this->getDefaultPriority(); |
316 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
316 | + $priority = (string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
317 | 317 | |
318 | 318 | if($preserveCache) { |
319 | 319 | $this->sortPriorities(); |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | if($priority !== false) { |
385 | 385 | if($priority === null) |
386 | 386 | $priority = $this->getDefaultPriority(); |
387 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
387 | + $priority = (string) round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
388 | 388 | |
389 | 389 | if($p[0] != $priority) |
390 | 390 | throw new TInvalidDataValueException('list_item_inexistent'); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | if($priority === null) |
430 | 430 | $priority = $this->getDefaultPriority(); |
431 | - $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
|
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'); |
@@ -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 | } |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | foreach($this->_d as $priority => $items) { |
499 | 499 | if(($index = array_search($item, $items, true)) !== false) { |
500 | 500 | $absindex += $index; |
501 | - return $withindex?[$priority,$index,$absindex, |
|
502 | - 'priority' => $priority,'index' => $index,'absindex' => $absindex]:$priority; |
|
501 | + return $withindex ? [$priority, $index, $absindex, |
|
502 | + 'priority' => $priority, 'index' => $index, 'absindex' => $absindex] : $priority; |
|
503 | 503 | } else |
504 | 504 | $absindex += count($items); |
505 | 505 | } |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | if($index >= ($c = count($items))) |
528 | 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 | } |
@@ -208,8 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | $this->sortPriorities(); |
210 | 210 | $this->_fd = []; |
211 | - foreach($this->_d as $priority => $itemsatpriority) |
|
212 | - $this->_fd = array_merge($this->_fd, $itemsatpriority); |
|
211 | + foreach($this->_d as $priority => $itemsatpriority) { |
|
212 | + $this->_fd = array_merge($this->_fd, $itemsatpriority); |
|
213 | + } |
|
213 | 214 | return $this->_fd; |
214 | 215 | } |
215 | 216 | |
@@ -318,9 +319,10 @@ discard block |
||
318 | 319 | if($preserveCache) { |
319 | 320 | $this->sortPriorities(); |
320 | 321 | $cc = 0; |
321 | - foreach($this->_d as $prioritykey => $items) |
|
322 | - if($prioritykey >= $priority) |
|
322 | + foreach($this->_d as $prioritykey => $items) { |
|
323 | + if($prioritykey >= $priority) |
|
323 | 324 | break; |
325 | + } |
|
324 | 326 | else |
325 | 327 | $cc += count($items); |
326 | 328 | |
@@ -391,8 +393,7 @@ discard block |
||
391 | 393 | } |
392 | 394 | $this->removeAtIndexInPriority($p[1], $p[0]); |
393 | 395 | return $p[2]; |
394 | - } |
|
395 | - else |
|
396 | + } else |
|
396 | 397 | throw new TInvalidDataValueException('list_item_inexistent'); |
397 | 398 | } |
398 | 399 | |
@@ -454,8 +455,9 @@ discard block |
||
454 | 455 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
455 | 456 | |
456 | 457 | foreach($this->_d as $priority => $items) { |
457 | - for($index = count($items) - 1;$index >= 0;$index--) |
|
458 | - $this->removeAtIndexInPriority($index, $priority); |
|
458 | + for($index = count($items) - 1;$index >= 0;$index--) { |
|
459 | + $this->removeAtIndexInPriority($index, $priority); |
|
460 | + } |
|
459 | 461 | unset($this->_d[$priority]); |
460 | 462 | } |
461 | 463 | } |
@@ -647,14 +649,16 @@ discard block |
||
647 | 649 | $this->clear(); |
648 | 650 | foreach($data->getPriorities() as $priority) |
649 | 651 | { |
650 | - foreach($data->itemsAtPriority($priority) as $index => $item) |
|
651 | - $this->insertAtIndexInPriority($item, $index, $priority); |
|
652 | + foreach($data->itemsAtPriority($priority) as $index => $item) { |
|
653 | + $this->insertAtIndexInPriority($item, $index, $priority); |
|
654 | + } |
|
652 | 655 | } |
653 | 656 | } elseif(is_array($data) || $data instanceof \Traversable) { |
654 | 657 | if($this->getCount() > 0) |
655 | 658 | $this->clear(); |
656 | - foreach($data as $key => $item) |
|
657 | - $this->add($item); |
|
659 | + foreach($data as $key => $item) { |
|
660 | + $this->add($item); |
|
661 | + } |
|
658 | 662 | } elseif($data !== null) |
659 | 663 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
660 | 664 | } |
@@ -673,17 +677,17 @@ discard block |
||
673 | 677 | { |
674 | 678 | foreach($data->getPriorities() as $priority) |
675 | 679 | { |
676 | - foreach($data->itemsAtPriority($priority) as $index => $item) |
|
677 | - $this->insertAtIndexInPriority($item, false, $priority); |
|
680 | + foreach($data->itemsAtPriority($priority) as $index => $item) { |
|
681 | + $this->insertAtIndexInPriority($item, false, $priority); |
|
682 | + } |
|
678 | 683 | } |
679 | - } |
|
680 | - elseif(is_array($data) || $data instanceof \Traversable) |
|
684 | + } elseif(is_array($data) || $data instanceof \Traversable) |
|
681 | 685 | { |
682 | - foreach($data as $priority => $item) |
|
683 | - $this->add($item); |
|
686 | + foreach($data as $priority => $item) { |
|
687 | + $this->add($item); |
|
688 | + } |
|
684 | 689 | |
685 | - } |
|
686 | - elseif($data !== null) |
|
690 | + } elseif($data !== null) |
|
687 | 691 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
688 | 692 | } |
689 | 693 |
@@ -231,7 +231,7 @@ |
||
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 |
@@ -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 | |
@@ -231,8 +225,9 @@ discard block |
||
231 | 225 | */ |
232 | 226 | public function clear() |
233 | 227 | { |
234 | - for($i = $this->_c - 1;$i >= 0;--$i) |
|
235 | - $this->removeAt($i); |
|
228 | + for($i = $this->_c - 1;$i >= 0;--$i) { |
|
229 | + $this->removeAt($i); |
|
230 | + } |
|
236 | 231 | } |
237 | 232 | |
238 | 233 | /** |
@@ -275,8 +270,7 @@ discard block |
||
275 | 270 | $this->insertAt($index, $item); |
276 | 271 | |
277 | 272 | return $index; |
278 | - } |
|
279 | - else |
|
273 | + } else |
|
280 | 274 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
281 | 275 | } |
282 | 276 | |
@@ -299,8 +293,7 @@ discard block |
||
299 | 293 | $this->insertAt($index + 1, $item); |
300 | 294 | |
301 | 295 | return $index + 1; |
302 | - } |
|
303 | - else |
|
296 | + } else |
|
304 | 297 | throw new TInvalidOperationException('list_readonly', get_class($this)); |
305 | 298 | } |
306 | 299 | |
@@ -324,10 +317,10 @@ discard block |
||
324 | 317 | { |
325 | 318 | if($this->_c > 0) |
326 | 319 | $this->clear(); |
327 | - foreach($data as $item) |
|
328 | - $this->add($item); |
|
329 | - } |
|
330 | - elseif($data !== null) |
|
320 | + foreach($data as $item) { |
|
321 | + $this->add($item); |
|
322 | + } |
|
323 | + } elseif($data !== null) |
|
331 | 324 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
332 | 325 | } |
333 | 326 | |
@@ -341,10 +334,10 @@ discard block |
||
341 | 334 | { |
342 | 335 | if(is_array($data) || ($data instanceof \Traversable)) |
343 | 336 | { |
344 | - foreach($data as $item) |
|
345 | - $this->add($item); |
|
346 | - } |
|
347 | - elseif($data !== null) |
|
337 | + foreach($data as $item) { |
|
338 | + $this->add($item); |
|
339 | + } |
|
340 | + } elseif($data !== null) |
|
348 | 341 | throw new TInvalidDataTypeException('list_data_not_iterable'); |
349 | 342 | } |
350 | 343 |
@@ -57,9 +57,9 @@ |
||
57 | 57 | protected function _getZappableSleepProps(&$exprops) |
58 | 58 | { |
59 | 59 | parent::_getZappableSleepProps($exprops); |
60 | - if ($this->_d === []) |
|
60 | + if($this->_d === []) |
|
61 | 61 | $exprops[] = "\0Prado\Collections\TMap\0_d"; |
62 | - if ($this->_r === false) |
|
62 | + if($this->_r === false) |
|
63 | 63 | $exprops[] = "\0Prado\Collections\TMap\0_r"; |
64 | 64 | } |
65 | 65 |
@@ -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 | |
@@ -183,8 +181,9 @@ discard block |
||
183 | 181 | */ |
184 | 182 | public function clear() |
185 | 183 | { |
186 | - foreach(array_keys($this->_d) as $key) |
|
187 | - $this->remove($key); |
|
184 | + foreach(array_keys($this->_d) as $key) { |
|
185 | + $this->remove($key); |
|
186 | + } |
|
188 | 187 | } |
189 | 188 | |
190 | 189 | /** |
@@ -216,10 +215,10 @@ discard block |
||
216 | 215 | { |
217 | 216 | if($this->getCount() > 0) |
218 | 217 | $this->clear(); |
219 | - foreach($data as $key => $value) |
|
220 | - $this->add($key, $value); |
|
221 | - } |
|
222 | - elseif($data !== null) |
|
218 | + foreach($data as $key => $value) { |
|
219 | + $this->add($key, $value); |
|
220 | + } |
|
221 | + } elseif($data !== null) |
|
223 | 222 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
224 | 223 | } |
225 | 224 | |
@@ -233,10 +232,10 @@ discard block |
||
233 | 232 | { |
234 | 233 | if(is_array($data) || $data instanceof Traversable) |
235 | 234 | { |
236 | - foreach($data as $key => $value) |
|
237 | - $this->add($key, $value); |
|
238 | - } |
|
239 | - elseif($data !== null) |
|
235 | + foreach($data as $key => $value) { |
|
236 | + $this->add($key, $value); |
|
237 | + } |
|
238 | + } elseif($data !== null) |
|
240 | 239 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
241 | 240 | } |
242 | 241 |
@@ -54,7 +54,7 @@ |
||
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 | } |
@@ -54,8 +54,9 @@ |
||
54 | 54 | public function rewind() |
55 | 55 | { |
56 | 56 | $this->_iterator->rewind(); |
57 | - for($i = 0;$i < $this->_startIndex;++$i) |
|
58 | - $this->_iterator->next(); |
|
57 | + for($i = 0;$i < $this->_startIndex;++$i) { |
|
58 | + $this->_iterator->next(); |
|
59 | + } |
|
59 | 60 | $this->_index = 0; |
60 | 61 | } |
61 | 62 |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | if($this->_customPaging) |
251 | 251 | { |
252 | 252 | if($this->_virtualCount >= 0) |
253 | - return (int)(($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
|
253 | + return (int) (($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
|
254 | 254 | else |
255 | 255 | return -1; |
256 | 256 | } |
257 | 257 | else |
258 | - return (int)((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
|
258 | + return (int) ((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | public function indexOf($item) |
327 | 327 | { |
328 | 328 | $c = $this->getCount(); |
329 | - for($i = 0;$i < $c;++$i) |
|
329 | + for($i = 0; $i < $c; ++$i) |
|
330 | 330 | if($this->itemAt($i) === $item) |
331 | 331 | return $i; |
332 | 332 | return -1; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | { |
363 | 363 | $c = $this->getCount(); |
364 | 364 | $array = []; |
365 | - for($i = 0;$i < $c;++$i) |
|
365 | + for($i = 0; $i < $c; ++$i) |
|
366 | 366 | $array[$i] = $this->itemAt($i); |
367 | 367 | return $array; |
368 | 368 | } |
@@ -186,22 +186,18 @@ discard block |
||
186 | 186 | $this->_currentPageIndex = $pageIndex; |
187 | 187 | $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); |
188 | 188 | return $pageIndex; |
189 | - } |
|
190 | - else |
|
189 | + } else |
|
191 | 190 | return false; |
192 | - } |
|
193 | - else |
|
191 | + } else |
|
194 | 192 | return false; |
195 | - } |
|
196 | - else |
|
193 | + } else |
|
197 | 194 | { |
198 | 195 | if($pageIndex >= 0 && $pageIndex < $this->getPageCount()) |
199 | 196 | { |
200 | 197 | $this->_currentPageIndex = $pageIndex; |
201 | 198 | $this->onPageIndexChanged(null); |
202 | 199 | return $pageIndex; |
203 | - } |
|
204 | - else |
|
200 | + } else |
|
205 | 201 | return false; |
206 | 202 | } |
207 | 203 | } |
@@ -253,8 +249,7 @@ discard block |
||
253 | 249 | return (int)(($this->_virtualCount + $this->_pageSize - 1) / $this->_pageSize); |
254 | 250 | else |
255 | 251 | return -1; |
256 | - } |
|
257 | - else |
|
252 | + } else |
|
258 | 253 | return (int)((parent::getCount() + $this->_pageSize - 1) / $this->_pageSize); |
259 | 254 | } |
260 | 255 | |
@@ -326,9 +321,10 @@ discard block |
||
326 | 321 | public function indexOf($item) |
327 | 322 | { |
328 | 323 | $c = $this->getCount(); |
329 | - for($i = 0;$i < $c;++$i) |
|
330 | - if($this->itemAt($i) === $item) |
|
324 | + for($i = 0;$i < $c;++$i) { |
|
325 | + if($this->itemAt($i) === $item) |
|
331 | 326 | return $i; |
327 | + } |
|
332 | 328 | return -1; |
333 | 329 | } |
334 | 330 | |
@@ -362,8 +358,9 @@ discard block |
||
362 | 358 | { |
363 | 359 | $c = $this->getCount(); |
364 | 360 | $array = []; |
365 | - for($i = 0;$i < $c;++$i) |
|
366 | - $array[$i] = $this->itemAt($i); |
|
361 | + for($i = 0;$i < $c;++$i) { |
|
362 | + $array[$i] = $this->itemAt($i); |
|
363 | + } |
|
367 | 364 | return $array; |
368 | 365 | } |
369 | 366 | } |
370 | 367 | \ No newline at end of file |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | protected function _getZappableSleepProps(&$exprops) |
53 | 53 | { |
54 | 54 | parent::_getZappableSleepProps($exprops); |
55 | - if ($this->_caseSensitive === false) |
|
55 | + if($this->_caseSensitive === false) |
|
56 | 56 | $exprops[] = "\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
57 | 57 | } |
58 | 58 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function __get($name) |
68 | 68 | { |
69 | - return $this->contains($name)?$this->itemAt($name):parent::__get($name); |
|
69 | + return $this->contains($name) ? $this->itemAt($name) : parent::__get($name); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function itemAt($key) |
108 | 108 | { |
109 | - return parent::itemAt($this->_caseSensitive?$key:strtolower($key)); |
|
109 | + return parent::itemAt($this->_caseSensitive ? $key : strtolower($key)); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function add($key, $value) |
120 | 120 | { |
121 | - parent::add($this->_caseSensitive?$key:strtolower($key), $value); |
|
121 | + parent::add($this->_caseSensitive ? $key : strtolower($key), $value); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function remove($key) |
131 | 131 | { |
132 | - return parent::remove($this->_caseSensitive?$key:strtolower($key)); |
|
132 | + return parent::remove($this->_caseSensitive ? $key : strtolower($key)); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function contains($key) |
142 | 142 | { |
143 | - return parent::contains($this->_caseSensitive?$key:strtolower($key)); |
|
143 | + return parent::contains($this->_caseSensitive ? $key : strtolower($key)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $status = TPropertyValue::ensureInteger($status); |
284 | 284 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
285 | 285 | $this->_reason = self::$HTTP_STATUS_CODES[$status]; |
286 | - }else{ |
|
286 | + } else{ |
|
287 | 287 | if($reason === null || $reason === '') { |
288 | 288 | throw new TInvalidDataValueException("response_status_reason_missing"); |
289 | 289 | } |
@@ -377,10 +377,10 @@ discard block |
||
377 | 377 | $this->sendHttpHeader(); |
378 | 378 | if(is_array($headers)) |
379 | 379 | { |
380 | - foreach($headers as $h) |
|
381 | - header($h); |
|
382 | - } |
|
383 | - else |
|
380 | + foreach($headers as $h) { |
|
381 | + header($h); |
|
382 | + } |
|
383 | + } else |
|
384 | 384 | { |
385 | 385 | header('Pragma: public'); |
386 | 386 | header('Expires: 0'); |
@@ -505,13 +505,11 @@ discard block |
||
505 | 505 | { |
506 | 506 | $this->_bufferOutput = false; |
507 | 507 | ob_end_flush(); |
508 | - } |
|
509 | - else |
|
508 | + } else |
|
510 | 509 | ob_flush(); |
511 | 510 | flush(); |
512 | 511 | } |
513 | - } |
|
514 | - else |
|
512 | + } else |
|
515 | 513 | flush(); |
516 | 514 | } |
517 | 515 | |
@@ -659,8 +657,7 @@ discard block |
||
659 | 657 | $cookie->getSecure(), |
660 | 658 | $cookie->getHttpOnly() |
661 | 659 | ); |
662 | - } |
|
663 | - else { |
|
660 | + } else { |
|
664 | 661 | setcookie( |
665 | 662 | $cookie->getName(), |
666 | 663 | $cookie->getValue(), |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function setCacheControl($value) |
205 | 205 | { |
206 | - session_cache_limiter(TPropertyValue::ensureEnum($value, ['none','nocache','private','private_no_expire','public'])); |
|
206 | + session_cache_limiter(TPropertyValue::ensureEnum($value, ['none', 'nocache', 'private', 'private_no_expire', 'public'])); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | /** |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function setContentType($type) |
213 | 213 | { |
214 | - if ($this->_contentTypeHeaderSent) |
|
214 | + if($this->_contentTypeHeaderSent) |
|
215 | 215 | throw new \Exception('Unable to alter content-type as it has been already sent'); |
216 | 216 | $this->_contentType = $type; |
217 | 217 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setCharset($charset) |
239 | 239 | { |
240 | - $this->_charset = (strToLower($charset) === 'false') ? false : (string)$charset; |
|
240 | + $this->_charset = (strToLower($charset) === 'false') ? false : (string) $charset; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -278,12 +278,12 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function setStatusCode($status, $reason = null) |
280 | 280 | { |
281 | - if ($this->_httpHeaderSent) |
|
281 | + if($this->_httpHeaderSent) |
|
282 | 282 | throw new \Exception('Unable to alter response as HTTP header already sent'); |
283 | 283 | $status = TPropertyValue::ensureInteger($status); |
284 | 284 | if(isset(self::$HTTP_STATUS_CODES[$status])) { |
285 | 285 | $this->_reason = self::$HTTP_STATUS_CODES[$status]; |
286 | - }else{ |
|
286 | + } else { |
|
287 | 287 | if($reason === null || $reason === '') { |
288 | 288 | throw new TInvalidDataValueException("response_status_reason_missing"); |
289 | 289 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | public function write($str) |
322 | 322 | { |
323 | 323 | // when starting output make sure we send the headers first |
324 | - if (!$this->_bufferOutput and !$this->_httpHeaderSent) |
|
324 | + if(!$this->_bufferOutput and !$this->_httpHeaderSent) |
|
325 | 325 | $this->ensureHeadersSent(); |
326 | 326 | echo $str; |
327 | 327 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $clientFileName = basename($clientFileName); |
373 | 373 | |
374 | 374 | if($fileSize === null || $fileSize < 0) |
375 | - $fileSize = ($content === null?filesize($fileName):strlen($content)); |
|
375 | + $fileSize = ($content === null ?filesize($fileName) : strlen($content)); |
|
376 | 376 | |
377 | 377 | $this->sendHttpHeader(); |
378 | 378 | if(is_array($headers)) |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $isIIS = (stripos($this->getRequest()->getServerSoftware(), "microsoft-iis") !== false); |
434 | 434 | if($url[0] === '/') |
435 | 435 | $url = $this->getRequest()->getBaseUrl() . $url; |
436 | - if ($this->_status >= 300 && $this->_status < 400) |
|
436 | + if($this->_status >= 300 && $this->_status < 400) |
|
437 | 437 | { |
438 | 438 | // The status code has been modified to a valid redirection status, send it |
439 | 439 | if($isIIS) |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | if($this->_bufferOutput) |
500 | 500 | { |
501 | 501 | // avoid forced send of http headers (ob_flush() does that) if there's no output yet |
502 | - if (ob_get_length() > 0) |
|
502 | + if(ob_get_length() > 0) |
|
503 | 503 | { |
504 | - if (!$continueBuffering) |
|
504 | + if(!$continueBuffering) |
|
505 | 505 | { |
506 | 506 | $this->_bufferOutput = false; |
507 | 507 | ob_end_flush(); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | protected function ensureHttpHeaderSent() |
522 | 522 | { |
523 | - if (!$this->_httpHeaderSent) |
|
523 | + if(!$this->_httpHeaderSent) |
|
524 | 524 | $this->sendHttpHeader(); |
525 | 525 | } |
526 | 526 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | */ |
544 | 544 | protected function ensureContentTypeHeaderSent() |
545 | 545 | { |
546 | - if (!$this->_contentTypeHeaderSent) |
|
546 | + if(!$this->_contentTypeHeaderSent) |
|
547 | 547 | $this->sendContentTypeHeader(); |
548 | 548 | } |
549 | 549 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | protected function sendContentTypeHeader() |
554 | 554 | { |
555 | - $contentType = $this->_contentType === null?self::DEFAULT_CONTENTTYPE:$this->_contentType; |
|
555 | + $contentType = $this->_contentType === null ?self::DEFAULT_CONTENTTYPE : $this->_contentType; |
|
556 | 556 | $charset = $this->getCharset(); |
557 | 557 | if($charset === false) { |
558 | 558 | $this->appendHeader('Content-Type: ' . $contentType); |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | public function getContents() |
578 | 578 | { |
579 | 579 | Prado::trace("Retrieving output", 'Prado\Web\THttpResponse'); |
580 | - return $this->_bufferOutput?ob_get_contents():''; |
|
580 | + return $this->_bufferOutput ?ob_get_contents() : ''; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | /** |
@@ -174,8 +174,9 @@ discard block |
||
174 | 174 | protected function initPageContext($pageConfig) |
175 | 175 | { |
176 | 176 | $application = $this->getApplication(); |
177 | - foreach($pageConfig->getApplicationConfigurations() as $appConfig) |
|
178 | - $application->applyConfiguration($appConfig); |
|
177 | + foreach($pageConfig->getApplicationConfigurations() as $appConfig) { |
|
178 | + $application->applyConfiguration($appConfig); |
|
179 | + } |
|
179 | 180 | |
180 | 181 | $this->applyConfiguration($pageConfig); |
181 | 182 | } |
@@ -240,8 +241,7 @@ discard block |
||
240 | 241 | $pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), ''); |
241 | 242 | } |
242 | 243 | $pageConfig->loadFromFiles($this->getBasePath()); |
243 | - } |
|
244 | - else |
|
244 | + } else |
|
245 | 245 | { |
246 | 246 | $configCached = true; |
247 | 247 | $currentTimestamp = []; |
@@ -259,8 +259,7 @@ discard block |
||
259 | 259 | $currentTimestamp[0] = $appConfigFile === null?0:@filemtime($appConfigFile); |
260 | 260 | if($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0])) |
261 | 261 | $configCached = false; |
262 | - } |
|
263 | - else |
|
262 | + } else |
|
264 | 263 | { |
265 | 264 | $currentTimestamp[$fileName] = @filemtime($fileName); |
266 | 265 | if($currentTimestamp[$fileName] > $timestamp || ($timestamp > 0 && !$currentTimestamp[$fileName])) |
@@ -268,8 +267,7 @@ discard block |
||
268 | 267 | } |
269 | 268 | } |
270 | 269 | } |
271 | - } |
|
272 | - else |
|
270 | + } else |
|
273 | 271 | { |
274 | 272 | $configCached = false; |
275 | 273 | $paths = explode('.', $pagePath); |
@@ -502,8 +500,7 @@ discard block |
||
502 | 500 | |
503 | 501 | if(!class_exists($className, false)) |
504 | 502 | $className = $namespacedClassName; |
505 | - } |
|
506 | - else |
|
503 | + } else |
|
507 | 504 | { |
508 | 505 | $className = $this->getBasePageClass(); |
509 | 506 | Prado::using($className); |
@@ -530,8 +527,9 @@ discard block |
||
530 | 527 | */ |
531 | 528 | protected function runPage($page, $properties) |
532 | 529 | { |
533 | - foreach($properties as $name => $value) |
|
534 | - $page->setSubProperty($name, $value); |
|
530 | + foreach($properties as $name => $value) { |
|
531 | + $page->setSubProperty($name, $value); |
|
532 | + } |
|
535 | 533 | $page->run($this->getResponse()->createHtmlWriter()); |
536 | 534 | } |
537 | 535 |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | if($fileName === 0) // application config file |
257 | 257 | { |
258 | 258 | $appConfigFile = $application->getConfigurationFile(); |
259 | - $currentTimestamp[0] = $appConfigFile === null?0:@filemtime($appConfigFile); |
|
259 | + $currentTimestamp[0] = $appConfigFile === null ? 0 : @filemtime($appConfigFile); |
|
260 | 260 | if($currentTimestamp[0] > $timestamp || ($timestamp > 0 && !$currentTimestamp[0])) |
261 | 261 | $configCached = false; |
262 | 262 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $configPath .= DIRECTORY_SEPARATOR . $path; |
285 | 285 | } |
286 | 286 | $appConfigFile = $application->getConfigurationFile(); |
287 | - $currentTimestamp[0] = $appConfigFile === null?0:@filemtime($appConfigFile); |
|
287 | + $currentTimestamp[0] = $appConfigFile === null ? 0 : @filemtime($appConfigFile); |
|
288 | 288 | } |
289 | 289 | if(!$configCached) |
290 | 290 | { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $pageConfig->loadPageConfigurationFromXml($config, $application->getBasePath(), ''); |
298 | 298 | } |
299 | 299 | $pageConfig->loadFromFiles($this->getBasePath()); |
300 | - $cache->set(self::CONFIG_CACHE_PREFIX . $this->getID() . $pagePath, [$pageConfig,$currentTimestamp]); |
|
300 | + $cache->set(self::CONFIG_CACHE_PREFIX . $this->getID() . $pagePath, [$pageConfig, $currentTimestamp]); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | return $pageConfig; |