@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function getPage(): int |
| 105 | 105 | { |
| 106 | - if ($this->pageNumber < 1) { |
|
| 106 | + if ($this->pageNumber < 1){ |
|
| 107 | 107 | return 1; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ($this->pageNumber > $this->countPages) { |
|
| 110 | + if ($this->pageNumber > $this->countPages){ |
|
| 111 | 111 | return $this->countPages; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public function paginate(PaginableInterface $target): PaginatorInterface |
| 129 | 129 | { |
| 130 | 130 | $paginator = clone $this; |
| 131 | - if ($target instanceof \Countable && $paginator->count === 0) { |
|
| 131 | + if ($target instanceof \Countable && $paginator->count === 0){ |
|
| 132 | 132 | $paginator->setCount($target->count()); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function countDisplayed(): int |
| 161 | 161 | { |
| 162 | - if ($this->getPage() == $this->countPages) { |
|
| 162 | + if ($this->getPage() == $this->countPages){ |
|
| 163 | 163 | return $this->count - $this->getOffset(); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function nextPage() |
| 181 | 181 | { |
| 182 | - if ($this->getPage() != $this->countPages) { |
|
| 182 | + if ($this->getPage() != $this->countPages){ |
|
| 183 | 183 | return $this->getPage() + 1; |
| 184 | 184 | } |
| 185 | 185 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function previousPage() |
| 193 | 193 | { |
| 194 | - if ($this->getPage() > 1) { |
|
| 194 | + if ($this->getPage() > 1){ |
|
| 195 | 195 | return $this->getPage() - 1; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -208,9 +208,9 @@ discard block |
||
| 208 | 208 | private function setCount(int $count): self |
| 209 | 209 | { |
| 210 | 210 | $this->count = max($count, 0); |
| 211 | - if ($this->count > 0) { |
|
| 211 | + if ($this->count > 0){ |
|
| 212 | 212 | $this->countPages = (int)ceil($this->count / $this->limit); |
| 213 | - } else { |
|
| 213 | + }else{ |
|
| 214 | 214 | $this->countPages = 1; |
| 215 | 215 | } |
| 216 | 216 | |
@@ -103,11 +103,13 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function getPage(): int |
| 105 | 105 | { |
| 106 | - if ($this->pageNumber < 1) { |
|
| 106 | + if ($this->pageNumber < 1) |
|
| 107 | + { |
|
| 107 | 108 | return 1; |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | - if ($this->pageNumber > $this->countPages) { |
|
| 111 | + if ($this->pageNumber > $this->countPages) |
|
| 112 | + { |
|
| 111 | 113 | return $this->countPages; |
| 112 | 114 | } |
| 113 | 115 | |
@@ -128,7 +130,8 @@ discard block |
||
| 128 | 130 | public function paginate(PaginableInterface $target): PaginatorInterface |
| 129 | 131 | { |
| 130 | 132 | $paginator = clone $this; |
| 131 | - if ($target instanceof \Countable && $paginator->count === 0) { |
|
| 133 | + if ($target instanceof \Countable && $paginator->count === 0) |
|
| 134 | + { |
|
| 132 | 135 | $paginator->setCount($target->count()); |
| 133 | 136 | } |
| 134 | 137 | |
@@ -159,7 +162,8 @@ discard block |
||
| 159 | 162 | */ |
| 160 | 163 | public function countDisplayed(): int |
| 161 | 164 | { |
| 162 | - if ($this->getPage() == $this->countPages) { |
|
| 165 | + if ($this->getPage() == $this->countPages) |
|
| 166 | + { |
|
| 163 | 167 | return $this->count - $this->getOffset(); |
| 164 | 168 | } |
| 165 | 169 | |
@@ -179,7 +183,8 @@ discard block |
||
| 179 | 183 | */ |
| 180 | 184 | public function nextPage() |
| 181 | 185 | { |
| 182 | - if ($this->getPage() != $this->countPages) { |
|
| 186 | + if ($this->getPage() != $this->countPages) |
|
| 187 | + { |
|
| 183 | 188 | return $this->getPage() + 1; |
| 184 | 189 | } |
| 185 | 190 | |
@@ -191,7 +196,8 @@ discard block |
||
| 191 | 196 | */ |
| 192 | 197 | public function previousPage() |
| 193 | 198 | { |
| 194 | - if ($this->getPage() > 1) { |
|
| 199 | + if ($this->getPage() > 1) |
|
| 200 | + { |
|
| 195 | 201 | return $this->getPage() - 1; |
| 196 | 202 | } |
| 197 | 203 | |
@@ -208,9 +214,12 @@ discard block |
||
| 208 | 214 | private function setCount(int $count): self |
| 209 | 215 | { |
| 210 | 216 | $this->count = max($count, 0); |
| 211 | - if ($this->count > 0) { |
|
| 217 | + if ($this->count > 0) |
|
| 218 | + { |
|
| 212 | 219 | $this->countPages = (int)ceil($this->count / $this->limit); |
| 213 | - } else { |
|
| 220 | + } |
|
| 221 | + else |
|
| 222 | + { |
|
| 214 | 223 | $this->countPages = 1; |
| 215 | 224 | } |
| 216 | 225 | |