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 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
SideFacetsDeferred
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 getResults
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getActiveFacets
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
1<?php
2
3/**
4 * SideFacetsDeferred Recommendations Module
5 *
6 * PHP version 8
7 *
8 * Copyright (C) The National Library of Finland 2016-2018.
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   Ere Maijala <ere.maijala@helsinki.fi>
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 * SideFacetsDeferred Recommendations Module
34 *
35 * This class provides recommendations displaying facets beside search results
36 * after the search results have been displayed
37 *
38 * @category VuFind
39 * @package  Recommendations
40 * @author   Ere Maijala <ere.maijala@helsinki.fi>
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 SideFacetsDeferred extends SideFacets
45{
46    /**
47     * Get results stored in the object.
48     *
49     * @return \VuFind\Search\Base\Results
50     */
51    public function getResults()
52    {
53        // Since we didn't add facets in init, do it now so that the config is
54        // available for e.g. $this->results->getParams()->getFilterList().
55        parent::init($this->results->getParams(), null);
56        return $this->results;
57    }
58
59    /**
60     * Get active facets (key => display string)
61     *
62     * @return array
63     */
64    public function getActiveFacets()
65    {
66        return $this->mainFacets;
67    }
68
69    /**
70     * Called before the Search Results object performs its main search
71     * (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
72     * This method is responsible for setting search parameters needed by the
73     * recommendation module and for reading any existing search parameters that may
74     * be needed.
75     *
76     * We'll not do anything here since we want to defer the whole process until the
77     * search is done.
78     *
79     * @param \VuFind\Search\Base\Params $params  Search parameter object
80     * @param \Laminas\Stdlib\Parameters $request Parameter object representing user
81     * request.
82     *
83     * @return void
84     */
85    public function init($params, $request)
86    {
87    }
88}