1 | <?php |
||
11 | class PaginateRoute |
||
12 | { |
||
13 | /** |
||
14 | * @var \Illuminate\Translation\Translator |
||
15 | */ |
||
16 | protected $translator; |
||
17 | |||
18 | /** |
||
19 | * @var \Illuminate\Routing\Router |
||
20 | */ |
||
21 | protected $router; |
||
22 | |||
23 | /** |
||
24 | * @var \Illuminate\Contracts\Routing\UrlGenerator |
||
25 | */ |
||
26 | protected $urlGenerator; |
||
27 | |||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | protected $pageKeyword; |
||
32 | |||
33 | /** |
||
34 | * @param \Illuminate\Translation\Translator $translator |
||
35 | * @param \Illuminate\Routing\Router $router |
||
36 | * @param \Illuminate\Contracts\Routing\UrlGenerator $urlGenerator |
||
37 | */ |
||
38 | public function __construct(Translator $translator, Router $router, UrlGenerator $urlGenerator) |
||
49 | |||
50 | /** |
||
51 | * Return the current page. |
||
52 | * |
||
53 | * @return int |
||
54 | */ |
||
55 | public function currentPage() |
||
61 | |||
62 | /** |
||
63 | * Check if the given page is the current page. |
||
64 | * |
||
65 | * @param int $page |
||
66 | * |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function isCurrentPage($page) |
||
73 | |||
74 | /** |
||
75 | * Get the next page number. |
||
76 | * |
||
77 | * @param \Illuminate\Contracts\Pagination\Paginator $paginator |
||
78 | * |
||
79 | * @return string|null |
||
80 | */ |
||
81 | public function nextPage(Paginator $paginator) |
||
89 | |||
90 | /** |
||
91 | * Determine wether there is a next page. |
||
92 | * |
||
93 | * @param \Illuminate\Contracts\Pagination\Paginator $paginator |
||
94 | * |
||
95 | * @return bool |
||
96 | */ |
||
97 | public function hasNextPage(Paginator $paginator) |
||
101 | |||
102 | /** |
||
103 | * Get the next page URL. |
||
104 | * |
||
105 | * @param \Illuminate\Contracts\Pagination\Paginator $paginator |
||
106 | * |
||
107 | * @return string|null |
||
108 | */ |
||
109 | public function nextPageUrl(Paginator $paginator) |
||
119 | |||
120 | /** |
||
121 | * Get the previous page number. |
||
122 | * |
||
123 | * @return string|null |
||
124 | */ |
||
125 | public function previousPage() |
||
133 | |||
134 | /** |
||
135 | * Determine wether there is a previous page. |
||
136 | * |
||
137 | * @return bool |
||
138 | */ |
||
139 | public function hasPreviousPage() |
||
143 | |||
144 | /** |
||
145 | * Get the previous page URL. |
||
146 | * |
||
147 | * @param bool $full Return the full version of the URL in for the first page |
||
148 | * Ex. /users/page/1 instead of /users |
||
149 | * |
||
150 | * @return string|null |
||
151 | */ |
||
152 | public function previousPageUrl($full = false) |
||
162 | |||
163 | /** |
||
164 | * Get all urls in an array. |
||
165 | * |
||
166 | * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator |
||
167 | * @param bool $full Return the full version of the URL in for the first page |
||
168 | * Ex. /users/page/1 instead of /users |
||
169 | * |
||
170 | * @return array |
||
171 | */ |
||
172 | public function allUrls(LengthAwarePaginator $paginator, $full = false) |
||
186 | |||
187 | /** |
||
188 | * Render a plain html list with previous, next and all urls. The current page gets a current class on the list item. |
||
189 | * |
||
190 | * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator |
||
191 | * @param bool $full Return the full version of the URL in for the first page |
||
192 | * Ex. /users/page/1 instead of /users |
||
193 | * @param string $class Include class on pagination list |
||
194 | * Ex. <ul class="pagination"> |
||
195 | * @param bool $additionalLinks Include prev and next links on pagination list |
||
196 | * |
||
197 | * @return string |
||
198 | */ |
||
199 | public function renderPageList(LengthAwarePaginator $paginator, $full = false, $class = null, $additionalLinks = false) |
||
232 | |||
233 | /** |
||
234 | * Render html link tags for SEO indication of previous and next page. |
||
235 | * |
||
236 | * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator |
||
237 | * @param bool $full Return the full version of the URL in for the first page |
||
238 | * Ex. /users/page/1 instead of /users |
||
239 | * |
||
240 | * @return string |
||
241 | */ |
||
242 | public function renderRelLinks(LengthAwarePaginator $paginator, $full = false) |
||
264 | |||
265 | /** |
||
266 | * @deprecated in favor of renderPageList. |
||
267 | * |
||
268 | * @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator |
||
269 | * @param bool $full Return the full version of the URL in for the first page |
||
270 | * Ex. /users/page/1 instead of /users |
||
271 | * |
||
272 | * @return string |
||
273 | */ |
||
274 | public function renderHtml(LengthAwarePaginator $paginator, $full = false) |
||
278 | |||
279 | /** |
||
280 | * Generate a page URL, based on the request's current URL. |
||
281 | * |
||
282 | * @param int $page |
||
283 | * @param bool $full Return the full version of the URL in for the first page |
||
284 | * Ex. /users/page/1 instead of /users |
||
285 | * |
||
286 | * @return string |
||
287 | */ |
||
288 | public function pageUrl($page, $full = false) |
||
300 | |||
301 | /** |
||
302 | * Append the page query to a URL. |
||
303 | * |
||
304 | * @param string $url |
||
305 | * @param int $page |
||
306 | * @param bool $full Return the full version of the URL in for the first page |
||
307 | * Ex. /users/page/1 instead of /users |
||
308 | * |
||
309 | * @return string |
||
310 | */ |
||
311 | public function addPageQuery($url, $page, $full = false) |
||
320 | |||
321 | /** |
||
322 | * Register the Route::paginate macro. |
||
323 | */ |
||
324 | public function registerMacros() |
||
337 | } |
||
338 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.