@@ -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 | |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct(TMap $map, $startIndex, $count) |
| 39 | 39 | { |
| 40 | - $this->_map = $map; |
|
| 41 | - $this->_index = 0; |
|
| 42 | - $this->_startIndex = $startIndex; |
|
| 40 | + $this->_map=$map; |
|
| 41 | + $this->_index=0; |
|
| 42 | + $this->_startIndex=$startIndex; |
|
| 43 | 43 | if($startIndex + $count > $map->getCount()) |
| 44 | - $this->_count = $map->getCount() - $startIndex; |
|
| 44 | + $this->_count=$map->getCount() - $startIndex; |
|
| 45 | 45 | else |
| 46 | - $this->_count = $count; |
|
| 47 | - $this->_iterator = $map->getIterator(); |
|
| 46 | + $this->_count=$count; |
|
| 47 | + $this->_iterator=$map->getIterator(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -54,9 +54,9 @@ discard block |
||
| 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 | - $this->_index = 0; |
|
| 59 | + $this->_index=0; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function __construct(&$data) |
| 46 | 46 | { |
| 47 | - $this->_d = &$data; |
|
| 48 | - $this->_i = 0; |
|
| 49 | - $this->_c = count($this->_d); |
|
| 47 | + $this->_d=&$data; |
|
| 48 | + $this->_i=0; |
|
| 49 | + $this->_c=count($this->_d); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function rewind() |
| 57 | 57 | { |
| 58 | - $this->_i = 0; |
|
| 58 | + $this->_i=0; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function __construct($pageIndex, $offset, $limit) |
| 43 | 43 | { |
| 44 | - $this->_pageIndex = $pageIndex; |
|
| 45 | - $this->_offset = $offset; |
|
| 46 | - $this->_limit = $limit; |
|
| 44 | + $this->_pageIndex=$pageIndex; |
|
| 45 | + $this->_offset=$offset; |
|
| 46 | + $this->_limit=$limit; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -83,6 +83,6 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function setData($value) |
| 85 | 85 | { |
| 86 | - $this->_data = $value; |
|
| 86 | + $this->_data=$value; |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | \ No newline at end of file |
@@ -63,26 +63,26 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * @var boolean whether to allow custom paging |
| 65 | 65 | */ |
| 66 | - private $_customPaging = false; |
|
| 66 | + private $_customPaging=false; |
|
| 67 | 67 | /** |
| 68 | 68 | * @var integer number of items in each page |
| 69 | 69 | */ |
| 70 | - private $_pageSize = 10; |
|
| 70 | + private $_pageSize=10; |
|
| 71 | 71 | /** |
| 72 | 72 | * @var integer current page index |
| 73 | 73 | */ |
| 74 | - private $_currentPageIndex = -1; |
|
| 74 | + private $_currentPageIndex=-1; |
|
| 75 | 75 | /** |
| 76 | 76 | * @var integer user-assigned number of items in data source |
| 77 | 77 | */ |
| 78 | - private $_virtualCount = -1; |
|
| 78 | + private $_virtualCount=-1; |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Constructor. |
| 82 | 82 | * @param array|Iterator the initial data. Default is null, meaning no initialization. |
| 83 | 83 | * @param boolean whether the list is read-only. Always true for paged list. |
| 84 | 84 | */ |
| 85 | - public function __construct($data = null, $readOnly = false) |
|
| 85 | + public function __construct($data=null, $readOnly=false) |
|
| 86 | 86 | { |
| 87 | 87 | parent::__construct($data, true); |
| 88 | 88 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function setCustomPaging($value) |
| 102 | 102 | { |
| 103 | - $this->_customPaging = TPropertyValue::ensureBoolean($value); |
|
| 103 | + $this->_customPaging=TPropertyValue::ensureBoolean($value); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | /** |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function setPageSize($value) |
| 118 | 118 | { |
| 119 | - if(($value = TPropertyValue::ensureInteger($value)) > 0) |
|
| 120 | - $this->_pageSize = $value; |
|
| 119 | + if(($value=TPropertyValue::ensureInteger($value)) > 0) |
|
| 120 | + $this->_pageSize=$value; |
|
| 121 | 121 | else |
| 122 | 122 | throw new TInvalidDataValueException('pagedlist_pagesize_invalid'); |
| 123 | 123 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function setCurrentPageIndex($value) |
| 138 | 138 | { |
| 139 | - if($this->gotoPage($value = TPropertyValue::ensureInteger($value)) === false) |
|
| 139 | + if($this->gotoPage($value=TPropertyValue::ensureInteger($value))===false) |
|
| 140 | 140 | throw new TInvalidDataValueException('pagedlist_currentpageindex_invalid'); |
| 141 | 141 | } |
| 142 | 142 | |
@@ -169,21 +169,21 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function gotoPage($pageIndex) |
| 171 | 171 | { |
| 172 | - if($pageIndex === $this->_currentPageIndex) |
|
| 172 | + if($pageIndex===$this->_currentPageIndex) |
|
| 173 | 173 | return $pageIndex; |
| 174 | 174 | if($this->_customPaging) |
| 175 | 175 | { |
| 176 | 176 | if($pageIndex >= 0 && ($this->_virtualCount < 0 || $pageIndex < $this->getPageCount())) |
| 177 | 177 | { |
| 178 | - $param = new TPagedListFetchDataEventParameter($pageIndex, $this->_pageSize * $pageIndex, $this->_pageSize); |
|
| 178 | + $param=new TPagedListFetchDataEventParameter($pageIndex, $this->_pageSize * $pageIndex, $this->_pageSize); |
|
| 179 | 179 | $this->onFetchData($param); |
| 180 | - if(($data = $param->getData()) !== null) |
|
| 180 | + if(($data=$param->getData())!==null) |
|
| 181 | 181 | { |
| 182 | 182 | $this->setReadOnly(false); |
| 183 | 183 | $this->copyFrom($data); |
| 184 | 184 | $this->setReadOnly(true); |
| 185 | - $oldPage = $this->_currentPageIndex; |
|
| 186 | - $this->_currentPageIndex = $pageIndex; |
|
| 185 | + $oldPage=$this->_currentPageIndex; |
|
| 186 | + $this->_currentPageIndex=$pageIndex; |
|
| 187 | 187 | $this->onPageIndexChanged(new TPagedListPageChangedEventParameter($oldPage)); |
| 188 | 188 | return $pageIndex; |
| 189 | 189 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | if($pageIndex >= 0 && $pageIndex < $this->getPageCount()) |
| 199 | 199 | { |
| 200 | - $this->_currentPageIndex = $pageIndex; |
|
| 200 | + $this->_currentPageIndex=$pageIndex; |
|
| 201 | 201 | $this->onPageIndexChanged(null); |
| 202 | 202 | return $pageIndex; |
| 203 | 203 | } |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function setVirtualCount($value) |
| 239 | 239 | { |
| 240 | - if(($value = TPropertyValue::ensureInteger($value)) < 0) |
|
| 241 | - $value = -1; |
|
| 242 | - $this->_virtualCount = $value; |
|
| 240 | + if(($value=TPropertyValue::ensureInteger($value)) < 0) |
|
| 241 | + $value=-1; |
|
| 242 | + $this->_virtualCount=$value; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
@@ -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 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | public function getIsFirstPage() |
| 265 | 265 | { |
| 266 | - return $this->_currentPageIndex === 0; |
|
| 266 | + return $this->_currentPageIndex===0; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function getIsLastPage() |
| 273 | 273 | { |
| 274 | - return $this->_currentPageIndex === $this->getPageCount() - 1; |
|
| 274 | + return $this->_currentPageIndex===$this->getPageCount() - 1; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | return parent::getCount(); |
| 284 | 284 | else |
| 285 | 285 | { |
| 286 | - if($this->_currentPageIndex === $this->getPageCount() - 1) |
|
| 286 | + if($this->_currentPageIndex===$this->getPageCount() - 1) |
|
| 287 | 287 | return parent::getCount() - $this->_pageSize * $this->_currentPageIndex; |
| 288 | 288 | else |
| 289 | 289 | return $this->_pageSize; |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | return parent::getIterator(); |
| 300 | 300 | else |
| 301 | 301 | { |
| 302 | - $data = $this->toArray(); |
|
| 302 | + $data=$this->toArray(); |
|
| 303 | 303 | return new \ArrayIterator($data); |
| 304 | 304 | } |
| 305 | 305 | } |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function indexOf($item) |
| 327 | 327 | { |
| 328 | - $c = $this->getCount(); |
|
| 329 | - for($i = 0;$i < $c;++$i) |
|
| 330 | - if($this->itemAt($i) === $item) |
|
| 328 | + $c=$this->getCount(); |
|
| 329 | + for($i=0; $i < $c; ++$i) |
|
| 330 | + if($this->itemAt($i)===$item) |
|
| 331 | 331 | return $i; |
| 332 | 332 | return -1; |
| 333 | 333 | } |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public function toArray() |
| 362 | 362 | { |
| 363 | - $c = $this->getCount(); |
|
| 364 | - $array = []; |
|
| 365 | - for($i = 0;$i < $c;++$i) |
|
| 366 | - $array[$i] = $this->itemAt($i); |
|
| 363 | + $c=$this->getCount(); |
|
| 364 | + $array=[]; |
|
| 365 | + for($i=0; $i < $c; ++$i) |
|
| 366 | + $array[$i]=$this->itemAt($i); |
|
| 367 | 367 | return $array; |
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | \ No newline at end of file |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | class TAttributeCollection extends TMap |
| 43 | 43 | { |
| 44 | - private $_caseSensitive = false; |
|
| 44 | + private $_caseSensitive=false; |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Returns an array with the names of all variables of this object that should NOT be serialized |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | protected function _getZappableSleepProps(&$exprops) |
| 53 | 53 | { |
| 54 | 54 | parent::_getZappableSleepProps($exprops); |
| 55 | - if ($this->_caseSensitive === false) |
|
| 56 | - $exprops[] = "\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
|
| 55 | + if($this->_caseSensitive===false) |
|
| 56 | + $exprops[]="\0Prado\Collections\TAttributeCollection\0_caseSensitive"; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -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 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function setCaseSensitive($value) |
| 97 | 97 | { |
| 98 | - $this->_caseSensitive = TPropertyValue::ensureBoolean($value); |
|
| 98 | + $this->_caseSensitive=TPropertyValue::ensureBoolean($value); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -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 | /** |
@@ -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 | /** |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public static function ensureBoolean($value) |
| 64 | 64 | { |
| 65 | - if (is_string($value)) |
|
| 66 | - return strcasecmp($value, 'true') == 0 || $value != 0; |
|
| 65 | + if(is_string($value)) |
|
| 66 | + return strcasecmp($value, 'true')==0 || $value!=0; |
|
| 67 | 67 | else |
| 68 | - return (boolean)$value; |
|
| 68 | + return (boolean) $value; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public static function ensureString($value) |
| 79 | 79 | { |
| 80 | - if (TJavaScript::isJsLiteral($value)) |
|
| 80 | + if(TJavaScript::isJsLiteral($value)) |
|
| 81 | 81 | return $value; |
| 82 | - if (is_bool($value)) |
|
| 83 | - return $value?'true':'false'; |
|
| 82 | + if(is_bool($value)) |
|
| 83 | + return $value ? 'true' : 'false'; |
|
| 84 | 84 | else |
| 85 | - return (string)$value; |
|
| 85 | + return (string) $value; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public static function ensureInteger($value) |
| 94 | 94 | { |
| 95 | - return (integer)$value; |
|
| 95 | + return (integer) $value; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public static function ensureFloat($value) |
| 104 | 104 | { |
| 105 | - return (float)$value; |
|
| 105 | + return (float) $value; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | if(is_string($value)) |
| 120 | 120 | { |
| 121 | - $value = trim($value); |
|
| 122 | - $len = strlen($value); |
|
| 123 | - if ($len >= 2 && $value[0] == '(' && $value[$len - 1] == ')') |
|
| 121 | + $value=trim($value); |
|
| 122 | + $len=strlen($value); |
|
| 123 | + if($len >= 2 && $value[0]=='(' && $value[$len - 1]==')') |
|
| 124 | 124 | { |
| 125 | - eval('$array=array' . $value . ';'); |
|
| 125 | + eval('$array=array'.$value.';'); |
|
| 126 | 126 | return $array; |
| 127 | 127 | } |
| 128 | 128 | else |
| 129 | - return $len > 0?[$value]:[]; |
|
| 129 | + return $len > 0 ? [$value] : []; |
|
| 130 | 130 | } |
| 131 | 131 | else |
| 132 | - return (array)$value; |
|
| 132 | + return (array) $value; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public static function ensureObject($value) |
| 141 | 141 | { |
| 142 | - return (object)$value; |
|
| 142 | + return (object) $value; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public static function ensureEnum($value, $enums) |
| 162 | 162 | { |
| 163 | - static $types = []; |
|
| 164 | - if(func_num_args() === 2 && is_string($enums)) |
|
| 163 | + static $types=[]; |
|
| 164 | + if(func_num_args()===2 && is_string($enums)) |
|
| 165 | 165 | { |
| 166 | 166 | if(!isset($types[$enums])) |
| 167 | - $types[$enums] = new \ReflectionClass($enums); |
|
| 167 | + $types[$enums]=new \ReflectionClass($enums); |
|
| 168 | 168 | if($types[$enums]->hasConstant($value)) |
| 169 | 169 | return $value; |
| 170 | 170 | else |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | elseif(!is_array($enums)) |
| 176 | 176 | { |
| 177 | - $enums = func_get_args(); |
|
| 177 | + $enums=func_get_args(); |
|
| 178 | 178 | array_shift($enums); |
| 179 | 179 | } |
| 180 | 180 | if(in_array($value, $enums, true)) |
@@ -190,6 +190,6 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public static function ensureNullIfEmpty($value) |
| 192 | 192 | { |
| 193 | - return empty($value)?null:$value; |
|
| 193 | + return empty($value) ?null:$value; |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | \ No newline at end of file |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * Name of the value stored in cache |
| 29 | 29 | */ |
| 30 | - const CACHE_NAME = 'prado:appstate'; |
|
| 30 | + const CACHE_NAME='prado:appstate'; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Initializes module. |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected function getStateFilePath() |
| 45 | 45 | { |
| 46 | - return $this->getApplication()->getRuntimePath() . '/global.cache'; |
|
| 46 | + return $this->getApplication()->getRuntimePath().'/global.cache'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function load() |
| 54 | 54 | { |
| 55 | - if(($cache = $this->getApplication()->getCache()) !== null && ($value = $cache->get(self::CACHE_NAME)) !== false) |
|
| 55 | + if(($cache=$this->getApplication()->getCache())!==null && ($value=$cache->get(self::CACHE_NAME))!==false) |
|
| 56 | 56 | return unserialize($value); |
| 57 | 57 | else |
| 58 | 58 | { |
| 59 | - if(($content = @file_get_contents($this->getStateFilePath())) !== false) |
|
| 59 | + if(($content=@file_get_contents($this->getStateFilePath()))!==false) |
|
| 60 | 60 | return unserialize($content); |
| 61 | 61 | else |
| 62 | 62 | return null; |
@@ -69,18 +69,18 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function save($state) |
| 71 | 71 | { |
| 72 | - $content = serialize($state); |
|
| 73 | - $saveFile = true; |
|
| 74 | - if(($cache = $this->getApplication()->getCache()) !== null) |
|
| 72 | + $content=serialize($state); |
|
| 73 | + $saveFile=true; |
|
| 74 | + if(($cache=$this->getApplication()->getCache())!==null) |
|
| 75 | 75 | { |
| 76 | - if($cache->get(self::CACHE_NAME) === $content) |
|
| 77 | - $saveFile = false; |
|
| 76 | + if($cache->get(self::CACHE_NAME)===$content) |
|
| 77 | + $saveFile=false; |
|
| 78 | 78 | else |
| 79 | 79 | $cache->set(self::CACHE_NAME, $content); |
| 80 | 80 | } |
| 81 | 81 | if($saveFile) |
| 82 | 82 | { |
| 83 | - $fileName = $this->getStateFilePath(); |
|
| 83 | + $fileName=$this->getStateFilePath(); |
|
| 84 | 84 | file_put_contents($fileName, $content, LOCK_EX); |
| 85 | 85 | } |
| 86 | 86 | } |