Skip to content

Commit 59e6a8c

Browse files
=
1 parent 751c3f4 commit 59e6a8c

6 files changed

Lines changed: 12 additions & 10 deletions

File tree

ArrayPaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct($items, $page, $perPage = Paginator::DEFAULT_PER_PAG
2828
{
2929
$this->currentPage = $page;
3030
$this->perPage = $perPage;
31-
$this->total = count($items);
31+
$this->total = \count($items);
3232
$this->lastPage = $this->calcLastPage();
3333
$this->items = $this->sliceItems($items);
3434
}

FeedsPaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct($source, $page = 1, $perPage = Paginator::DEFAULT_PE
3131
$this->items = $source->fetch($page,$perPage)->getItems();
3232

3333
if (empty($source->getPageKey()) == true) {
34-
$this->total = count($this->items);
34+
$this->total = \count($this->items);
3535
$this->items = $this->sliceItems($this->items);
3636
$this->lastPage = $this->calcLastPage();
3737
} else {

JsonPaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class JsonPaginator extends ArrayPaginator implements PaginatorInterface
2626
*/
2727
public function __construct($json, $page, $perPage = Paginator::DEFAULT_PER_PAGE)
2828
{
29-
$items = json_decode($json,true);
29+
$items = \json_decode($json,true);
3030
parent::__construct($items,$page,$perPage);
3131
}
3232
}

Paginator.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function getTotalItems()
135135
*/
136136
public function getLastItem()
137137
{
138-
return (is_array($this->items) == true) ? end($this->items) : Self::UNKNOWN;
138+
return (\is_array($this->items) == true) ? \end($this->items) : Self::UNKNOWN;
139139
}
140140

141141
/**
@@ -165,7 +165,7 @@ public function getPerPage()
165165
*/
166166
public function getItemsCount()
167167
{
168-
return count($this->items);
168+
return \count($this->items);
169169
}
170170

171171
/**
@@ -206,7 +206,7 @@ public function getPaginatorData()
206206
*/
207207
public static function create($source, $page = 1, $perPage = Self::DEFAULT_PER_PAGE)
208208
{
209-
if (is_null($source) == true || empty($source) == true) {
209+
if (\is_null($source) == true || empty($source) == true) {
210210
return new Self();
211211
};
212212

@@ -223,7 +223,7 @@ public static function create($source, $page = 1, $perPage = Self::DEFAULT_PER_P
223223
$paginator = new ArrayPaginator($source->toArray(),$page,$perPage);
224224
break;
225225
}
226-
case is_array($source): {
226+
case \is_array($source): {
227227
$paginator = new ArrayPaginator($source,$page,$perPage);
228228
break;
229229
}
@@ -247,7 +247,8 @@ public static function create($source, $page = 1, $perPage = Self::DEFAULT_PER_P
247247
protected function sliceItems($items)
248248
{
249249
$offset = ($this->currentPage - 1) * $this->getPerPage();
250-
return array_slice($items,$offset,$this->getPerPage());
250+
251+
return \array_slice($items,$offset,$this->getPerPage());
251252
}
252253

253254
/**
@@ -257,6 +258,6 @@ protected function sliceItems($items)
257258
*/
258259
protected function calcLastPage()
259260
{
260-
return max((int)ceil($this->total / $this->perPage), 1);
261+
return \max((int)\ceil($this->total / $this->perPage), 1);
261262
}
262263
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
77
#### Requirements
8-
* PHP 7.1
8+
* PHP 7.1, 7.2, 7.3
99

1010

1111
#### Install

SessionPaginator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public static function getViewType($namespace = null, $default = Paginator::TABL
4040
public static function setViewType($type, $namespace = null)
4141
{
4242
$type = (empty($type) == true) ? Paginator::TABLE_VIEW : $type;
43+
4344
return Session::set(Utils::createKey('paginator.view.type',$namespace),$type);
4445
}
4546

0 commit comments

Comments
 (0)