Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
AlphaBrowseLink
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 5
30
0.00% covered (danger)
0.00%
0 / 1
 setConfig
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 init
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 process
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getQuery
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getIndex
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * AlphaBrowseLink Recommendations Module
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  Recommendations
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/wiki/development:plugins:recommendation_modules Wiki
28 */
29
30namespace VuFind\Recommend;
31
32/**
33 * AlphaBrowseLink Recommendations Module
34 *
35 * This class recommends a look at the alphabrowse index.
36 *
37 * @category VuFind
38 * @package  Recommendations
39 * @author   Demian Katz <demian.katz@villanova.edu>
40 * @author   Anna Headley <aheadle1@swarthmore.edu>
41 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
42 * @link     https://vufind.org/wiki/development:plugins:recommendation_modules Wiki
43 */
44class AlphaBrowseLink implements RecommendInterface
45{
46    /**
47     * Search query submitted
48     *
49     * @var string
50     */
51    protected $query;
52
53    /**
54     * Alphabrowse index to link to
55     *
56     * @var string
57     */
58    protected $index;
59
60    /**
61     * Store the configuration of the recommendation module.
62     *
63     * @param string $settings Settings from searches.ini.
64     *
65     * @return void
66     */
67    public function setConfig($settings)
68    {
69        // so far there's just the one setting.
70        $this->index = $settings;
71    }
72
73    /**
74     * Called before the Search Results object performs its main search
75     * (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
76     * This method is responsible for setting search parameters needed by the
77     * recommendation module and for reading any existing search parameters that may
78     * be needed.
79     *
80     * @param \VuFind\Search\Base\Params $params  Search parameter object
81     * @param \Laminas\Stdlib\Parameters $request Parameter object representing user
82     * request.
83     *
84     * @return void
85     */
86    public function init($params, $request)
87    {
88    }
89
90    /**
91     * Called after the Search Results object has performed its main search. This
92     * may be used to extract necessary information from the Search Results object
93     * or to perform completely unrelated processing.
94     *
95     * @param \VuFind\Search\Base\Results $results Search results object
96     *
97     * @return void
98     */
99    public function process($results)
100    {
101        $this->query = $results->getParams()->getDisplayQuery();
102    }
103
104    /**
105     * Get the search query.
106     *
107     * @return string
108     */
109    public function getQuery()
110    {
111        return $this->query;
112    }
113
114    /**
115     * Get the alphabrowse index to link to
116     *
117     * @return string
118     */
119    public function getIndex()
120    {
121        return $this->index;
122    }
123}