Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
AbstractIdFetcher | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getInitialOffset | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
setupBackend | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
getIdsFromBackend | n/a |
0 / 0 |
n/a |
0 / 0 |
0 |
1 | <?php |
2 | |
3 | /** |
4 | * Abstract helper to get IDs for a sitemap from a backend (if supported). |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 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 Demian Katz <demian.katz@villanova.edu> |
26 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
27 | * @link https://vufind.org |
28 | */ |
29 | |
30 | namespace VuFind\Sitemap\Plugin\Index; |
31 | |
32 | use VuFindSearch\Service; |
33 | |
34 | /** |
35 | * Abstract helper to get IDs for a sitemap from a backend (if supported). |
36 | * |
37 | * @category VuFind |
38 | * @package Search |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org |
42 | */ |
43 | abstract class AbstractIdFetcher |
44 | { |
45 | /** |
46 | * Search service |
47 | * |
48 | * @var Service |
49 | */ |
50 | protected $searchService; |
51 | |
52 | /** |
53 | * Constructor. |
54 | * |
55 | * @param Service $searchService Search service |
56 | */ |
57 | public function __construct(Service $searchService) |
58 | { |
59 | $this->searchService = $searchService; |
60 | } |
61 | |
62 | /** |
63 | * Get the initial offset to seed the search process |
64 | * |
65 | * @return string |
66 | */ |
67 | abstract public function getInitialOffset(): string; |
68 | |
69 | /** |
70 | * Set up the backend. |
71 | * |
72 | * @param string $backend Search backend ID |
73 | * |
74 | * @return void |
75 | */ |
76 | abstract public function setupBackend(string $backend): void; |
77 | |
78 | /** |
79 | * Retrieve a batch of IDs. Returns an array with two possible keys: ids (the |
80 | * latest set of retrieved IDs) and nextOffset (an offset which can be passed |
81 | * to the next call to this function to retrieve the next page). When all IDs |
82 | * have been retrieved, the nextOffset value MUST NOT be included in the return |
83 | * array. |
84 | * |
85 | * @param string $backend Search backend ID |
86 | * @param string $currentOffset String representing progress through set |
87 | * @param int $countPerPage Page size |
88 | * @param array $filters Filters to apply to the search |
89 | * |
90 | * @return array |
91 | */ |
92 | abstract public function getIdsFromBackend( |
93 | string $backend, |
94 | string $currentOffset, |
95 | int $countPerPage, |
96 | array $filters |
97 | ): array; |
98 | } |