Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
6 / 6 |
CRAP | |
100.00% |
1 / 1 |
QueryOffsetLimitTrait | |
100.00% |
6 / 6 |
|
100.00% |
6 / 6 |
6 | |
100.00% |
1 / 1 |
getQuery | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setQuery | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getOffset | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setOffset | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getLimit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setLimit | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * Trait for commands with search query, offset and limit arguments. |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) The National Library of Finland 2021. |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2, |
12 | * as published by the Free Software Foundation. |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | * GNU General Public License for more details. |
18 | * |
19 | * You should have received a copy of the GNU General Public License |
20 | * along with this program; if not, write to the Free Software |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 | * |
23 | * @category VuFind |
24 | * @package Search |
25 | * @author Aleksi Peebles <aleksi.peebles@helsinki.fi> |
26 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
27 | * @link https://vufind.org |
28 | */ |
29 | |
30 | namespace VuFindSearch\Command\Feature; |
31 | |
32 | use VuFindSearch\Query\QueryInterface; |
33 | |
34 | /** |
35 | * Trait for commands with search query, offset and limit arguments. |
36 | * |
37 | * @category VuFind |
38 | * @package Search |
39 | * @author Aleksi Peebles <aleksi.peebles@helsinki.fi> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org |
42 | */ |
43 | trait QueryOffsetLimitTrait |
44 | { |
45 | /** |
46 | * Search query. |
47 | * |
48 | * @var QueryInterface |
49 | */ |
50 | protected $query; |
51 | |
52 | /** |
53 | * Search offset. |
54 | * |
55 | * @var int |
56 | */ |
57 | protected $offset; |
58 | |
59 | /** |
60 | * Search limit. |
61 | * |
62 | * @var int |
63 | */ |
64 | protected $limit; |
65 | |
66 | /** |
67 | * Return search query. |
68 | * |
69 | * @return QueryInterface |
70 | */ |
71 | public function getQuery(): QueryInterface |
72 | { |
73 | return $this->query; |
74 | } |
75 | |
76 | /** |
77 | * Set search query. |
78 | * |
79 | * @param QueryInterface $query Query |
80 | * |
81 | * @return void |
82 | */ |
83 | public function setQuery(QueryInterface $query): void |
84 | { |
85 | $this->query = $query; |
86 | } |
87 | |
88 | /** |
89 | * Return search offset. |
90 | * |
91 | * @return int |
92 | */ |
93 | public function getOffset(): int |
94 | { |
95 | return $this->offset; |
96 | } |
97 | |
98 | /** |
99 | * Set search offset. |
100 | * |
101 | * @param int $offset Offset |
102 | * |
103 | * @return void |
104 | */ |
105 | public function setOffset($offset): void |
106 | { |
107 | $this->offset = $offset; |
108 | } |
109 | |
110 | /** |
111 | * Return search limit. |
112 | * |
113 | * @return int |
114 | */ |
115 | public function getLimit(): int |
116 | { |
117 | return $this->limit; |
118 | } |
119 | |
120 | /** |
121 | * Set search limit. |
122 | * |
123 | * @param int $limit Limit |
124 | * |
125 | * @return void |
126 | */ |
127 | public function setLimit($limit): void |
128 | { |
129 | $this->limit = $limit; |
130 | } |
131 | } |