Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
AbstractResultsPassthrough
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 4
20
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
 getResults
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Simple abstract recommendation module that simply passes the Results object
5 * through to the template.
6 *
7 * PHP version 8
8 *
9 * Copyright (C) Villanova University 2017.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2,
13 * as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 *
24 * @category VuFind
25 * @package  Recommendations
26 * @author   Demian Katz <demian.katz@villanova.edu>
27 * @author   Chris Hallberg <challber@villanova.edu>
28 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
29 * @link     https://vufind.org/wiki/development:plugins:recommendation_modules Wiki
30 */
31
32namespace VuFind\Recommend;
33
34/**
35 * Simple abstract recommendation module that simply passes the Results object
36 * through to the template.
37 *
38 * @category VuFind
39 * @package  Recommendations
40 * @author   Demian Katz <demian.katz@villanova.edu>
41 * @author   Chris Hallberg <challber@villanova.edu>
42 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
43 * @link     https://vufind.org/wiki/development:plugins:recommendation_modules Wiki
44 */
45class AbstractResultsPassthrough implements RecommendInterface
46{
47    /**
48     * Search results object.
49     *
50     * @var \VuFind\Search\Base\Results
51     */
52    protected $results;
53
54    /**
55     * Store the configuration of the recommendation module.
56     *
57     * @param string $settings Settings from searches.ini.
58     *
59     * @return void
60     */
61    public function setConfig($settings)
62    {
63        // No settings used by default.
64    }
65
66    /**
67     * Called before the Search Results object performs its main search
68     * (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
69     * This method is responsible for setting search parameters needed by the
70     * recommendation module and for reading any existing search parameters that may
71     * be needed.
72     *
73     * @param \VuFind\Search\Base\Params $params  Search parameter object
74     * @param \Laminas\Stdlib\Parameters $request Parameter object representing user
75     * request.
76     *
77     * @return void
78     */
79    public function init($params, $request)
80    {
81        // No initialization required by default.
82    }
83
84    /**
85     * Called after the Search Results object has performed its main search. This
86     * may be used to extract necessary information from the Search Results object
87     * or to perform completely unrelated processing.
88     *
89     * @param \VuFind\Search\Base\Results $results Search results object
90     *
91     * @return void
92     */
93    public function process($results)
94    {
95        $this->results = $results;
96    }
97
98    /**
99     * Get results stored in the object.
100     *
101     * @return \VuFind\Search\Base\Results
102     */
103    public function getResults()
104    {
105        return $this->results;
106    }
107}