@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function addParameters(array $aParameters): JsCall |
125 | 125 | { |
126 | - foreach($aParameters as $xParameter) |
|
126 | + foreach ($aParameters as $xParameter) |
|
127 | 127 | { |
128 | 128 | $this->pushParameter(Parameter::make($xParameter)); |
129 | 129 | } |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | return $xParam->forArray(); |
145 | 145 | }, $this->aParameters), |
146 | 146 | ]]; |
147 | - if($this->bToInt) |
|
147 | + if ($this->bToInt) |
|
148 | 148 | { |
149 | 149 | $aCalls[] = [ |
150 | 150 | '_type' => 'func', |
151 | 151 | '_name' => 'jaxon.utils.string.toInt', |
152 | - 'params' => [[ '_type' => '_', '_name' => 'this' ]], |
|
152 | + 'params' => [['_type' => '_', '_name' => 'this']], |
|
153 | 153 | ]; |
154 | 154 | } |
155 | 155 | return [ |
@@ -140,17 +140,17 @@ |
||
140 | 140 | public function render(Paginator $xPaginator, Call $xCall, string $sWrapperId = '') |
141 | 141 | { |
142 | 142 | $aPages = $xPaginator->pages(); |
143 | - if(count($aPages) === 0) |
|
143 | + if (count($aPages) === 0) |
|
144 | 144 | { |
145 | 145 | return; |
146 | 146 | } |
147 | - if(!($xStore = $this->_render($aPages))) |
|
147 | + if (!($xStore = $this->_render($aPages))) |
|
148 | 148 | { |
149 | 149 | return; |
150 | 150 | } |
151 | 151 | |
152 | 152 | // Append the page number to the parameter list, if not yet given. |
153 | - if(!$xCall->hasPageNumber()) |
|
153 | + if (!$xCall->hasPageNumber()) |
|
154 | 154 | { |
155 | 155 | $xCall->addParameter(Parameter::PAGE_NUMBER, 0); |
156 | 156 | } |
@@ -154,8 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function updateTotalPages(): Paginator |
156 | 156 | { |
157 | - $this->nTotalPages = ($this->nItemsPerPage === 0 ? 0 : |
|
158 | - (int)ceil($this->nTotalItems / $this->nItemsPerPage)); |
|
157 | + $this->nTotalPages = ($this->nItemsPerPage === 0 ? 0 : (int) ceil($this->nTotalItems / $this->nItemsPerPage)); |
|
159 | 158 | return $this; |
160 | 159 | } |
161 | 160 | |
@@ -219,8 +218,7 @@ discard block |
||
219 | 218 | protected function getPrevPage(): Page |
220 | 219 | { |
221 | 220 | return $this->nCurrentPage <= 1 ? |
222 | - new Page('disabled', $this->sPreviousText, 0) : |
|
223 | - new Page('enabled', $this->sPreviousText, $this->nCurrentPage - 1); |
|
221 | + new Page('disabled', $this->sPreviousText, 0) : new Page('enabled', $this->sPreviousText, $this->nCurrentPage - 1); |
|
224 | 222 | } |
225 | 223 | |
226 | 224 | /** |
@@ -231,8 +229,7 @@ discard block |
||
231 | 229 | protected function getNextPage(): Page |
232 | 230 | { |
233 | 231 | return $this->nCurrentPage >= $this->nTotalPages ? |
234 | - new Page('disabled', $this->sNextText, 0) : |
|
235 | - new Page('enabled', $this->sNextText, $this->nCurrentPage + 1); |
|
232 | + new Page('disabled', $this->sNextText, 0) : new Page('enabled', $this->sNextText, $this->nCurrentPage + 1); |
|
236 | 233 | } |
237 | 234 | |
238 | 235 | /** |
@@ -244,7 +241,7 @@ discard block |
||
244 | 241 | */ |
245 | 242 | protected function getPage(int $nNumber): Page |
246 | 243 | { |
247 | - if($nNumber < 1) |
|
244 | + if ($nNumber < 1) |
|
248 | 245 | { |
249 | 246 | return new Page('disabled', $this->sEllipsysText, 0); |
250 | 247 | } |
@@ -263,9 +260,9 @@ discard block |
||
263 | 260 | { |
264 | 261 | $aPageNumbers = []; |
265 | 262 | |
266 | - if($this->nTotalPages <= $this->nMaxPages) |
|
263 | + if ($this->nTotalPages <= $this->nMaxPages) |
|
267 | 264 | { |
268 | - for($i = 0; $i < $this->nTotalPages; $i++) |
|
265 | + for ($i = 0; $i < $this->nTotalPages; $i++) |
|
269 | 266 | { |
270 | 267 | $aPageNumbers[] = $i + 1; |
271 | 268 | } |
@@ -274,11 +271,11 @@ discard block |
||
274 | 271 | } |
275 | 272 | |
276 | 273 | // Determine the sliding range, centered around the current page. |
277 | - $nNumAdjacents = (int)floor(($this->nMaxPages - 4) / 2); |
|
274 | + $nNumAdjacents = (int) floor(($this->nMaxPages - 4) / 2); |
|
278 | 275 | |
279 | 276 | $nSlidingStart = 1; |
280 | 277 | $nSlidingEndOffset = $nNumAdjacents + 3 - $this->nCurrentPage; |
281 | - if($nSlidingEndOffset < 0) |
|
278 | + if ($nSlidingEndOffset < 0) |
|
282 | 279 | { |
283 | 280 | $nSlidingStart = $this->nCurrentPage - $nNumAdjacents; |
284 | 281 | $nSlidingEndOffset = 0; |
@@ -286,23 +283,23 @@ discard block |
||
286 | 283 | |
287 | 284 | $nSlidingEnd = $this->nTotalPages; |
288 | 285 | $nSlidingStartOffset = $this->nCurrentPage + $nNumAdjacents + 2 - $this->nTotalPages; |
289 | - if($nSlidingStartOffset < 0) |
|
286 | + if ($nSlidingStartOffset < 0) |
|
290 | 287 | { |
291 | 288 | $nSlidingEnd = $this->nCurrentPage + $nNumAdjacents; |
292 | 289 | $nSlidingStartOffset = 0; |
293 | 290 | } |
294 | 291 | |
295 | 292 | // Build the list of page numbers. |
296 | - if($nSlidingStart > 1) |
|
293 | + if ($nSlidingStart > 1) |
|
297 | 294 | { |
298 | 295 | $aPageNumbers[] = 1; |
299 | 296 | $aPageNumbers[] = 0; // Ellipsys; |
300 | 297 | } |
301 | - for($i = $nSlidingStart - $nSlidingStartOffset; $i <= $nSlidingEnd + $nSlidingEndOffset; $i++) |
|
298 | + for ($i = $nSlidingStart - $nSlidingStartOffset; $i <= $nSlidingEnd + $nSlidingEndOffset; $i++) |
|
302 | 299 | { |
303 | 300 | $aPageNumbers[] = $i; |
304 | 301 | } |
305 | - if($nSlidingEnd < $this->nTotalPages) |
|
302 | + if ($nSlidingEnd < $this->nTotalPages) |
|
306 | 303 | { |
307 | 304 | $aPageNumbers[] = 0; // Ellipsys; |
308 | 305 | $aPageNumbers[] = $this->nTotalPages; |
@@ -318,7 +315,7 @@ discard block |
||
318 | 315 | */ |
319 | 316 | public function pages(): array |
320 | 317 | { |
321 | - if($this->nTotalPages < 2) |
|
318 | + if ($this->nTotalPages < 2) |
|
322 | 319 | { |
323 | 320 | return []; |
324 | 321 | } |