1 | <?php |
||
14 | trait LinksTrait |
||
15 | { |
||
16 | /** |
||
17 | * The links array. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $links; |
||
22 | |||
23 | /** |
||
24 | * Get the links. |
||
25 | * |
||
26 | * @return array |
||
27 | */ |
||
28 | 3 | public function getLinks() |
|
32 | |||
33 | /** |
||
34 | * Set the links. |
||
35 | * |
||
36 | * @param array $links |
||
37 | * |
||
38 | * @return $this |
||
39 | */ |
||
40 | public function setLinks(array $links) |
||
46 | |||
47 | /** |
||
48 | * Add a link. |
||
49 | * |
||
50 | * @param string $key |
||
51 | * @param string $value |
||
52 | * |
||
53 | * @return $this |
||
54 | */ |
||
55 | 6 | public function addLink($key, $value) |
|
61 | |||
62 | /** |
||
63 | * Add pagination links (first, prev, next, and last). |
||
64 | * |
||
65 | * @param string $url The base URL for pagination links. |
||
66 | * @param array $queryParams The query params provided in the request. |
||
67 | * @param int $offset The current offset. |
||
68 | * @param int $limit The current limit. |
||
69 | * @param int|null $total The total number of results, or null if unknown. |
||
70 | * |
||
71 | * @return void |
||
72 | */ |
||
73 | 3 | public function addPaginationLinks($url, array $queryParams, $offset, $limit, $total = null) |
|
93 | |||
94 | /** |
||
95 | * Add a pagination link. |
||
96 | * |
||
97 | * @param string $name The name of the link. |
||
98 | * @param string $url The base URL for pagination links. |
||
99 | * @param array $queryParams The query params provided in the request. |
||
100 | * @param int $offset The offset to link to. |
||
101 | * @param int $limit The current limit. |
||
102 | * |
||
103 | * @return void |
||
104 | */ |
||
105 | 3 | protected function addPaginationLink($name, $url, array $queryParams, $offset, $limit) |
|
135 | } |
||
136 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: