Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Options
0.00% covered (danger)
0.00%
0 / 14
0.00% covered (danger)
0.00%
0 / 5
72
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getFacetListAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSearchAction
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getRecommendationSettings
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
20
 getSearchBoxSearchClassId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Author aspect of the Search Multi-class (Options)
5 *
6 * PHP version 8
7 *
8 * Copyright (C) Villanova University 2010.
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_SolrAuthor
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 Main Site
28 */
29
30namespace VuFind\Search\SolrAuthor;
31
32/**
33 * Author Search Options
34 *
35 * @category VuFind
36 * @package  Search_SolrAuthor
37 * @author   Demian Katz <demian.katz@villanova.edu>
38 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
39 * @link     https://vufind.org Main Site
40 */
41class Options extends \VuFind\Search\Solr\Options
42{
43    /**
44     * Constructor
45     *
46     * @param \VuFind\Config\PluginManager $configLoader Config loader
47     */
48    public function __construct(\VuFind\Config\PluginManager $configLoader)
49    {
50        parent::__construct($configLoader);
51
52        // No spell check needed in author module:
53        $this->spellcheck = false;
54    }
55
56    /**
57     * Return the route name for the facet list action. Returns false to cover
58     * unimplemented support.
59     *
60     * @return string|bool
61     */
62    public function getFacetListAction()
63    {
64        return 'author-facetlist';
65    }
66
67    /**
68     * Return the route name for the search results action.
69     *
70     * @return string
71     */
72    public function getSearchAction()
73    {
74        return 'author-home';
75    }
76
77    /**
78     * Load all recommendation settings from the relevant ini file. Returns an
79     * associative array where the key is the location of the recommendations (top
80     * or side) and the value is the settings found in the file (which may be either
81     * a single string or an array of strings).
82     *
83     * @param string $handler Name of handler for which to load specific settings.
84     *
85     * @return array associative: location (top/side/etc.) => search settings
86     */
87    public function getRecommendationSettings($handler = null)
88    {
89        // Load the necessary settings to determine the appropriate recommendations
90        // module:
91        $ss = $this->configLoader->get($this->getSearchIni());
92
93        // Load the AuthorModuleRecommendations configuration if available, use
94        // standard defaults otherwise:
95        if (isset($ss->AuthorModuleRecommendations)) {
96            $recommend = [];
97            foreach ($ss->AuthorModuleRecommendations as $section => $content) {
98                $recommend[$section] = [];
99                foreach ($content as $current) {
100                    $recommend[$section][] = $current;
101                }
102            }
103        } else {
104            $recommend = ['side' => ['ExpandFacets:Author']];
105        }
106
107        return $recommend;
108    }
109
110    /**
111     * Get the search class ID for identifying search box options; this is normally
112     * the same as the current search class ID, but some "special purpose" search
113     * namespaces (e.g. SolrAuthor) need to point to a different ID for search box
114     * generation
115     *
116     * @return string
117     */
118    public function getSearchBoxSearchClassId(): string
119    {
120        return 'Solr';
121    }
122}