Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Libraryh3lp
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 5
42
0.00% covered (danger)
0.00%
0 / 1
 setConfig
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 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
 getChatId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getSkin
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Libraryh3lp 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 * @author   Chris Hallberg <challber@villanova.edu>
27 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
28 * @link     https://vufind.org/wiki/development:plugins:recommendation_modules Wiki
29 */
30
31namespace VuFind\Recommend;
32
33/**
34 * Libraryh3lp Recommendations Module
35 *
36 * This class provides access to the Libraryh3lp chat service.
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 Libraryh3lp implements RecommendInterface
46{
47    /**
48     * Chat identifier
49     *
50     * @var string
51     */
52    protected $chatId;
53
54    /**
55     * Widget skin number
56     *
57     * @var int
58     */
59    protected $skin;
60
61    /**
62     * Store the configuration of the recommendation module.
63     *
64     * @param string $settings Settings from searches.ini.
65     *
66     * @return void
67     */
68    public function setConfig($settings)
69    {
70        $params = explode(':', $settings);
71        $this->chatId = $params[0] === 'user'
72            ? $params[1] . '@libraryh3lp.com'           // user
73            : $params[1] . '@chat.libraryh3lp.com';     // queue
74        $this->skin = $params[2] ?? 11977;
75    }
76
77    /**
78     * Called before the Search Results object performs its main search
79     * (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
80     * This method is responsible for setting search parameters needed by the
81     * recommendation module and for reading any existing search parameters that may
82     * be needed.
83     *
84     * @param \VuFind\Search\Base\Params $params  Search parameter object
85     * @param \Laminas\Stdlib\Parameters $request Parameter object representing user
86     * request.
87     *
88     * @return void
89     */
90    public function init($params, $request)
91    {
92    }
93
94    /**
95     * Called after the Search Results object has performed its main search. This
96     * may be used to extract necessary information from the Search Results object
97     * or to perform completely unrelated processing.
98     *
99     * @param \VuFind\Search\Base\Results $results Search results object
100     *
101     * @return void
102     */
103    public function process($results)
104    {
105    }
106
107    /**
108     * Get queue name
109     *
110     * @return string
111     */
112    public function getChatId()
113    {
114        return $this->chatId;
115    }
116
117    /**
118     * Get skin number
119     *
120     * @return int
121     */
122    public function getSkin()
123    {
124        return $this->skin;
125    }
126}