Conditions | 4 |
Paths | 6 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
125 | protected function getLinks(int $count): array |
||
126 | { |
||
127 | $links = [ |
||
128 | 'self' => ['href' => $this->uri.'?offset='.$this->offset.'&limit='.$this->limit], |
||
129 | ]; |
||
130 | |||
131 | if ($this->offset > 0) { |
||
132 | $offset = $this->offset - $this->offset; |
||
133 | if ($offset < 0) { |
||
134 | $offset = 0; |
||
135 | } |
||
136 | |||
137 | $links['prev'] = [ |
||
138 | 'href' => $this->uri.'?offset='.$offset.'&limit='.$this->limit, |
||
139 | ]; |
||
140 | } |
||
141 | |||
142 | if ($this->offset + $count < $this->total) { |
||
143 | $links['next'] = [ |
||
144 | 'href' => $this->uri.'?offset='.($this->offset + $count).'&limit='.$this->limit, |
||
145 | ]; |
||
146 | } |
||
147 | |||
148 | return $links; |
||
149 | } |
||
150 | } |
||
151 |