diff --git a/module/VuFind/src/VuFind/Recommend/AbstractResultsPassthrough.php b/module/VuFind/src/VuFind/Recommend/AbstractResultsPassthrough.php new file mode 100644 index 0000000000000000000000000000000000000000..96ad5c783bddb29ecdac0678d4964b0a830bf4d2 --- /dev/null +++ b/module/VuFind/src/VuFind/Recommend/AbstractResultsPassthrough.php @@ -0,0 +1,104 @@ +<?php +/** + * Simple abstract recommendation module that simply passes the Results object + * through to the template. + * + * PHP version 5 + * + * Copyright (C) Villanova University 2017. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * @category VuFind + * @package Recommendations + * @author Demian Katz <demian.katz@villanova.edu> + * @author Chris Hallberg <challber@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:recommendation_modules Wiki + */ +namespace VuFind\Recommend; + +/** + * Simple abstract recommendation module that simply passes the Results object + * through to the template. + * + * @category VuFind + * @package Recommendations + * @author Demian Katz <demian.katz@villanova.edu> + * @author Chris Hallberg <challber@villanova.edu> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development:plugins:recommendation_modules Wiki + */ +class AbstractResultsPassthrough implements RecommendInterface +{ + /** + * Search results object. + * + * @var \VuFind\Search\Base\Results + */ + protected $results; + + /** + * Store the configuration of the recommendation module. + * + * @param string $settings Settings from searches.ini. + * + * @return void + */ + public function setConfig($settings) + { + // No settings used by default. + } + + /** + * Called at the end of the Search Params objects' initFromRequest() method. + * This method is responsible for setting search parameters needed by the + * recommendation module and for reading any existing search parameters that may + * be needed. + * + * @param \VuFind\Search\Base\Params $params Search parameter object + * @param \Zend\StdLib\Parameters $request Parameter object representing user + * request. + * + * @return void + */ + public function init($params, $request) + { + // No initialization required by default. + } + + /** + * Called after the Search Results object has performed its main search. This + * may be used to extract necessary information from the Search Results object + * or to perform completely unrelated processing. + * + * @param \VuFind\Search\Base\Results $results Search results object + * + * @return void + */ + public function process($results) + { + $this->results = $results; + } + + /** + * Get results stored in the object. + * + * @return \VuFind\Search\Base\Results + */ + public function getResults() + { + return $this->results; + } +} diff --git a/module/VuFind/src/VuFind/Recommend/SpellingSuggestions.php b/module/VuFind/src/VuFind/Recommend/SpellingSuggestions.php index 23675c4f2b3d1c5c0615c0afad46fc6f36f12a43..bd343d2a160e9717f38ad8ecd4aad949d3826735 100644 --- a/module/VuFind/src/VuFind/Recommend/SpellingSuggestions.php +++ b/module/VuFind/src/VuFind/Recommend/SpellingSuggestions.php @@ -38,64 +38,6 @@ namespace VuFind\Recommend; * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development:plugins:recommendation_modules Wiki */ -class SpellingSuggestions implements RecommendInterface +class SpellingSuggestions extends AbstractResultsPassthrough { - /** - * Search results object. - * - * @var \VuFind\Search\Base\Results - */ - protected $results; - - /** - * Store the configuration of the recommendation module. - * - * @param string $settings Settings from searches.ini. - * - * @return void - */ - public function setConfig($settings) - { - // No settings used at present. - } - - /** - * Called at the end of the Search Params objects' initFromRequest() method. - * This method is responsible for setting search parameters needed by the - * recommendation module and for reading any existing search parameters that may - * be needed. - * - * @param \VuFind\Search\Base\Params $params Search parameter object - * @param \Zend\StdLib\Parameters $request Parameter object representing user - * request. - * - * @return void - */ - public function init($params, $request) - { - } - - /** - * Called after the Search Results object has performed its main search. This - * may be used to extract necessary information from the Search Results object - * or to perform completely unrelated processing. - * - * @param \VuFind\Search\Base\Results $results Search results object - * - * @return void - */ - public function process($results) - { - $this->results = $results; - } - - /** - * Get results stored in the object. - * - * @return \VuFind\Search\Base\Results - */ - public function getResults() - { - return $this->results; - } }