Updated paging to PHP7

This commit is contained in:
Nyholm 2019-01-18 06:19:39 +01:00 committed by David Garcia
parent 61ae9bc945
commit ac056e9f75
2 changed files with 9 additions and 33 deletions

View File

@ -19,41 +19,25 @@ trait PaginationResponse
/**
* @var array
*/
protected $paging;
private $paging;
public function getNextUrl(): ?string
{
if (!isset($this->paging['next'])) {
return null;
}
return $this->paging['next'];
return $this->paging['next'] ?? null;
}
public function getPreviousUrl(): ?string
{
if (!isset($this->paging['previous'])) {
return null;
}
return $this->paging['previous'];
return $this->paging['previous'] ?? null;
}
public function getFirstUrl(): ?string
{
if (!isset($this->paging['first'])) {
return null;
}
return $this->paging['first'];
return $this->paging['first'] ?? null;
}
public function getLastUrl(): ?string
{
if (!isset($this->paging['last'])) {
return null;
}
return $this->paging['last'];
return $this->paging['last'] ?? null;
}
}

View File

@ -18,29 +18,21 @@ interface PagingProvider
{
/**
* Returns the `$paging->next` URL.
*
* @return string
*/
public function getNextUrl();
public function getNextUrl(): ?string;
/**
* Returns the `$paging->prev` URL.
*
* @return string
*/
public function getPreviousUrl();
public function getPreviousUrl(): ?string;
/**
* Returns the `$paging->first` URL.
*
* @return string
*/
public function getFirstUrl();
public function getFirstUrl(): ?string;
/**
* Returns the `$paging->last` URL.
*
* @return string
*/
public function getLastUrl();
public function getLastUrl(): ?string;
}