Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
FacetCloud | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
getFacetLimit | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
3 |
1 | <?php |
2 | |
3 | /** |
4 | * FacetCloud Recommendations Module |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2011. |
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 Recommendations |
25 | * @author Demian Katz <demian.katz@villanova.edu> |
26 | * @author Lutz Biedinger <lutz.biedinger@gmail.com> |
27 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
28 | * @link https://vufind.org Main Page |
29 | */ |
30 | |
31 | namespace VuFind\Recommend; |
32 | |
33 | use function is_callable; |
34 | |
35 | /** |
36 | * FacetCloud Recommendations Module |
37 | * |
38 | * @category VuFind |
39 | * @package Recommendations |
40 | * @author Demian Katz <demian.katz@villanova.edu> |
41 | * @author Lutz Biedinger <lutz.biedinger@gmail.com> |
42 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
43 | * @link https://vufind.org Main Page |
44 | */ |
45 | class FacetCloud extends ExpandFacets |
46 | { |
47 | /** |
48 | * Get the facet limit. |
49 | * |
50 | * @return int |
51 | */ |
52 | public function getFacetLimit() |
53 | { |
54 | $params = $this->searchObject->getParams(); |
55 | $settings = is_callable([$params, 'getFacetSettings']) |
56 | ? $params->getFacetSettings() : []; |
57 | |
58 | // Figure out the facet limit -- if available, we can use this to display |
59 | // "..." when more facets are available than are currently being displayed, |
60 | // although this comes at the cost of not being able to display the last |
61 | // entry in the list -- otherwise we might show "..." when we've exactly |
62 | // reached (but not exceeded) the facet limit. If we can't get a facet |
63 | // limit, we will set an arbitrary high number so that all available values |
64 | // will display and "..." will never display. |
65 | return isset($settings['limit']) ? $settings['limit'] - 1 : 100000; |
66 | } |
67 | } |