Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
PluginManager
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 getExpectedInterface
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Search params plugin manager
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  Search
25 * @author   Demian Katz <demian.katz@villanova.edu>
26 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
27 * @link     https://vufind.org/wiki/development:plugins:record_drivers Wiki
28 */
29
30namespace VuFind\Search\Params;
31
32/**
33 * Search params plugin manager
34 *
35 * @category VuFind
36 * @package  Search
37 * @author   Demian Katz <demian.katz@villanova.edu>
38 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
39 * @link     https://vufind.org/wiki/development:plugins:record_drivers Wiki
40 */
41class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
42{
43    /**
44     * Default plugin aliases.
45     *
46     * @var array
47     */
48    protected $aliases = [
49        'blender' => \VuFind\Search\Blender\Params::class,
50        'browzine' => \VuFind\Search\BrowZine\Params::class,
51        'combined' => \VuFind\Search\Combined\Params::class,
52        'eds' => \VuFind\Search\EDS\Params::class,
53        'eit' => \VuFind\Search\EIT\Params::class,
54        'epf' => \VuFind\Search\EPF\Params::class,
55        'emptyset' => \VuFind\Search\EmptySet\Params::class,
56        'favorites' => \VuFind\Search\Favorites\Params::class,
57        'libguides' => \VuFind\Search\LibGuides\Params::class,
58        'libguidesaz' => \VuFind\Search\LibGuidesAZ\Params::class,
59        'mixedlist' => \VuFind\Search\MixedList\Params::class,
60        'pazpar2' => \VuFind\Search\Pazpar2\Params::class,
61        'primo' => \VuFind\Search\Primo\Params::class,
62        'search2' => \VuFind\Search\Search2\Params::class,
63        'solr' => \VuFind\Search\Solr\Params::class,
64        'solrauth' => \VuFind\Search\SolrAuth\Params::class,
65        'solrauthor' => \VuFind\Search\SolrAuthor\Params::class,
66        'solrauthorfacets' => \VuFind\Search\SolrAuthorFacets\Params::class,
67        'solrcollection' => \VuFind\Search\SolrCollection\Params::class,
68        'solrreserves' => \VuFind\Search\SolrReserves\Params::class,
69        'solrweb' => \VuFind\Search\SolrWeb\Params::class,
70        'summon' => \VuFind\Search\Summon\Params::class,
71        'tags' => \VuFind\Search\Tags\Params::class,
72        'worldcat' => \VuFind\Search\WorldCat\Params::class,
73    ];
74
75    /**
76     * Default plugin factories.
77     *
78     * @var array
79     */
80    protected $factories = [
81        \VuFind\Search\Blender\Params::class
82            => \VuFind\Search\Blender\ParamsFactory::class,
83        \VuFind\Search\BrowZine\Params::class => ParamsFactory::class,
84        \VuFind\Search\Combined\Params::class => ParamsFactory::class,
85        \VuFind\Search\EDS\Params::class => ParamsFactory::class,
86        \VuFind\Search\EIT\Params::class => ParamsFactory::class,
87        \VuFind\Search\EPF\Params::class => ParamsFactory::class,
88        \VuFind\Search\EmptySet\Params::class => ParamsFactory::class,
89        \VuFind\Search\Favorites\Params::class => ParamsFactory::class,
90        \VuFind\Search\LibGuides\Params::class => ParamsFactory::class,
91        \VuFind\Search\LibGuidesAZ\Params::class => ParamsFactory::class,
92        \VuFind\Search\MixedList\Params::class => ParamsFactory::class,
93        \VuFind\Search\Pazpar2\Params::class => ParamsFactory::class,
94        \VuFind\Search\Primo\Params::class => ParamsFactory::class,
95        \VuFind\Search\Search2\Params::class =>
96            \VuFind\Search\Solr\ParamsFactory::class,
97        \VuFind\Search\Solr\Params::class =>
98            \VuFind\Search\Solr\ParamsFactory::class,
99        \VuFind\Search\SolrAuth\Params::class => ParamsFactory::class,
100        \VuFind\Search\SolrAuthor\Params::class => ParamsFactory::class,
101        \VuFind\Search\SolrAuthorFacets\Params::class =>  ParamsFactory::class,
102        \VuFind\Search\SolrCollection\Params::class => ParamsFactory::class,
103        \VuFind\Search\SolrReserves\Params::class => ParamsFactory::class,
104        \VuFind\Search\SolrWeb\Params::class => ParamsFactory::class,
105        \VuFind\Search\Summon\Params::class => ParamsFactory::class,
106        \VuFind\Search\Tags\Params::class => ParamsFactory::class,
107        \VuFind\Search\WorldCat\Params::class => ParamsFactory::class,
108    ];
109
110    /**
111     * Constructor
112     *
113     * Make sure plugins are properly initialized.
114     *
115     * @param mixed $configOrContainerInstance Configuration or container instance
116     * @param array $v3config                  If $configOrContainerInstance is a
117     * container, this value will be passed to the parent constructor.
118     */
119    public function __construct(
120        $configOrContainerInstance = null,
121        array $v3config = []
122    ) {
123        // These objects are not meant to be shared -- every time we retrieve one,
124        // we are building a brand new object.
125        $this->sharedByDefault = false;
126
127        $this->addAbstractFactory(PluginFactory::class);
128        parent::__construct($configOrContainerInstance, $v3config);
129    }
130
131    /**
132     * Return the name of the base class or interface that plug-ins must conform
133     * to.
134     *
135     * @return string
136     */
137    protected function getExpectedInterface()
138    {
139        return \VuFind\Search\Base\Params::class;
140    }
141}