From ac056e9f7568488b23106a6e48ac77463da1c039 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Fri, 18 Jan 2019 06:19:39 +0100 Subject: [PATCH] Updated paging to PHP7 --- src/Model/PaginationResponse.php | 26 +++++--------------------- src/Model/PagingProvider.php | 16 ++++------------ 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/src/Model/PaginationResponse.php b/src/Model/PaginationResponse.php index 470e216..42d297d 100644 --- a/src/Model/PaginationResponse.php +++ b/src/Model/PaginationResponse.php @@ -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; } } diff --git a/src/Model/PagingProvider.php b/src/Model/PagingProvider.php index ab79b15..be1e8ad 100644 --- a/src/Model/PagingProvider.php +++ b/src/Model/PagingProvider.php @@ -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; }