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