Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
Options
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 3
182
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
132
 getSearchAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getAdvancedSearchAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * EBSCO EIT API Search Options
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  Search_EIT
25 * @author   Julia Bauder <bauderj@grinnell.edu>
26 * @author   Demian Katz <demian.katz@villanova.edu>
27 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
28 * @link     https://vufind.org Main Page
29 */
30
31namespace VuFind\Search\EIT;
32
33use function count;
34
35/**
36 * EBSCO EIT Search Options
37 * Largely copied from WorldCat Search Options
38 *
39 * @category VuFind
40 * @package  Search_EIT
41 * @author   Julia Bauder <bauderj@grinnell.edu>
42 * @author   Demian Katz <demian.katz@villanova.edu>
43 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
44 * @link     https://vufind.org Main Page
45 */
46class Options extends \VuFind\Search\Base\Options
47{
48    /**
49     * Constructor
50     *
51     * @param \VuFind\Config\PluginManager $configLoader Config loader
52     */
53    public function __construct(\VuFind\Config\PluginManager $configLoader)
54    {
55        parent::__construct($configLoader);
56        $this->searchIni = $this->facetsIni = 'EIT';
57
58        // Load the configuration file:
59        $searchSettings = $configLoader->get($this->searchIni);
60        if (isset($searchSettings->Basic_Searches)) {
61            foreach ($searchSettings->Basic_Searches as $key => $value) {
62                $this->basicHandlers[$key] = $value;
63            }
64        }
65        if (isset($searchSettings->Advanced_Searches)) {
66            foreach ($searchSettings->Advanced_Searches as $key => $value) {
67                $this->advancedHandlers[$key] = $value;
68            }
69        }
70
71        // Load sort preferences:
72        if (isset($searchSettings->Sorting)) {
73            foreach ($searchSettings->Sorting as $key => $value) {
74                $this->sortOptions[$key] = $value;
75            }
76        }
77        if (isset($searchSettings->General->default_sort)) {
78            $this->defaultSort = $searchSettings->General->default_sort;
79        }
80        if (
81            isset($searchSettings->DefaultSortingByType)
82            && count($searchSettings->DefaultSortingByType) > 0
83        ) {
84            foreach ($searchSettings->DefaultSortingByType as $key => $val) {
85                $this->defaultSortByHandler[$key] = $val;
86            }
87        }
88    }
89
90    /**
91     * Return the route name for the search results action.
92     *
93     * @return string
94     */
95    public function getSearchAction()
96    {
97        return 'eit-search';
98    }
99
100    /**
101     * Return the route name of the action used for performing advanced searches.
102     * Returns false if the feature is not supported.
103     *
104     * @return string|bool
105     */
106    public function getAdvancedSearchAction()
107    {
108        return 'eit-advanced';
109    }
110}