Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
AlphaBrowseTrait
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 alphabeticBrowse
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * VuFind Action Feature Trait - Alphabetic browse support
5 * Depends on direct access to the Service Manager.
6 *
7 * PHP version 8
8 *
9 * Copyright (C) Villanova University 2021
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  Controller_Plugins
26 * @author   Demian Katz <demian.katz@villanova.edu>
27 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
28 * @link     https://vufind.org Main Page
29 */
30
31namespace VuFind\Controller\Feature;
32
33use VuFindSearch\Command\AlphabeticBrowseCommand;
34
35use function func_get_args;
36
37/**
38 * VuFind Action Feature Trait - Alphabetic browse support
39 *
40 * @category VuFind
41 * @package  Controller_Plugins
42 * @author   Demian Katz <demian.katz@villanova.edu>
43 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
44 * @link     https://vufind.org Main Page
45 */
46trait AlphaBrowseTrait
47{
48    /**
49     * The name of the backend providing alphabrowse services.
50     *
51     * @var string
52     */
53    protected $alphabrowseBackend = 'Solr';
54
55    /**
56     * Proxy Backend::alphabeticBrowse using the CallMethodCommand.
57     *
58     * @return array
59     */
60    protected function alphabeticBrowse()
61    {
62        $service = $this->serviceLocator->get(\VuFindSearch\Service::class);
63        $command = new AlphabeticBrowseCommand(
64            $this->alphabrowseBackend,
65            ...func_get_args()
66        );
67        return $service->invoke($command)->getResult();
68    }
69}