1 | <?php |
||
18 | class Options |
||
19 | { |
||
20 | /** |
||
21 | * @var HydrationOptions |
||
22 | */ |
||
23 | protected $hydrationOptions; |
||
24 | |||
25 | /** |
||
26 | * @var int|null |
||
27 | */ |
||
28 | protected $limit; |
||
29 | |||
30 | /** |
||
31 | * @var int|null |
||
32 | */ |
||
33 | protected $offset; |
||
34 | |||
35 | /** |
||
36 | * Set the (maximum) number of results to return. |
||
37 | */ |
||
38 | 12 | public function setLimit(int $limit, ?int $offset = null): self |
|
47 | |||
48 | 19 | public function getLimit(): ?int |
|
52 | |||
53 | /** |
||
54 | * Unset limit of results |
||
55 | * Provides fluent interface. |
||
56 | * |
||
57 | * @param bool $unset_offset whether to unset offset as well |
||
58 | * |
||
59 | * @return Options |
||
60 | */ |
||
61 | 1 | public function unsetLimit($unset_offset = true): self |
|
70 | |||
71 | /** |
||
72 | * Tells whether the option contains a limit. |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | 43 | public function hasLimit(): bool |
|
80 | |||
81 | /** |
||
82 | * Tells whether the option contains an offset. |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 12 | public function hasOffset(): bool |
|
90 | |||
91 | /** |
||
92 | * Set the offset (the record to start reading when using limit). |
||
93 | */ |
||
94 | 7 | public function setOffset(int $offset): self |
|
100 | |||
101 | /** |
||
102 | * Return the offset when using limit |
||
103 | * Offset gives the record number to start reading |
||
104 | * from when a paging query is in use. |
||
105 | * |
||
106 | * @return int|null |
||
107 | */ |
||
108 | 15 | public function getOffset() |
|
112 | |||
113 | /** |
||
114 | * Unset previously set offset. |
||
115 | * |
||
116 | * @return Options |
||
117 | */ |
||
118 | 1 | public function unsetOffset() |
|
124 | |||
125 | 40 | public function getHydrationOptions(): HydrationOptions |
|
133 | } |
||
134 |