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 * @var array
*/ */
protected $paging; private $paging;
public function getNextUrl(): ?string public function getNextUrl(): ?string
{ {
if (!isset($this->paging['next'])) { return $this->paging['next'] ?? null;
return null;
}
return $this->paging['next'];
} }
public function getPreviousUrl(): ?string public function getPreviousUrl(): ?string
{ {
if (!isset($this->paging['previous'])) { return $this->paging['previous'] ?? null;
return null;
}
return $this->paging['previous'];
} }
public function getFirstUrl(): ?string public function getFirstUrl(): ?string
{ {
if (!isset($this->paging['first'])) { return $this->paging['first'] ?? null;
return null;
}
return $this->paging['first'];
} }
public function getLastUrl(): ?string public function getLastUrl(): ?string
{ {
if (!isset($this->paging['last'])) { return $this->paging['last'] ?? null;
return null;
}
return $this->paging['last'];
} }
} }

View File

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