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 | * Recommendation module 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 Recommendations |
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:recommendation_modules Wiki |
28 | */ |
29 | |
30 | namespace VuFind\Recommend; |
31 | |
32 | use Laminas\ServiceManager\Factory\InvokableFactory; |
33 | |
34 | /** |
35 | * Recommendation module plugin manager |
36 | * |
37 | * @category VuFind |
38 | * @package Recommendations |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
41 | * @link https://vufind.org/wiki/development:plugins:recommendation_modules Wiki |
42 | */ |
43 | class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager |
44 | { |
45 | /** |
46 | * Default plugin aliases. |
47 | * |
48 | * @var array |
49 | */ |
50 | protected $aliases = [ |
51 | 'alphabrowselink' => AlphaBrowseLink::class, |
52 | 'authorfacets' => AuthorFacets::class, |
53 | 'authorinfo' => AuthorInfo::class, |
54 | 'authorityrecommend' => AuthorityRecommend::class, |
55 | 'catalogresults' => CatalogResults::class, |
56 | 'channels' => Channels::class, |
57 | 'collectionsidefacets' => CollectionSideFacets::class, |
58 | 'consortialvufind' => ConsortialVuFind::class, |
59 | 'consortialvufinddeferred' => ConsortialVuFindDeferred::class, |
60 | 'databases' => Databases::class, |
61 | 'doi' => DOI::class, |
62 | 'dplaterms' => DPLATerms::class, |
63 | 'edsresults' => EDSResults::class, |
64 | 'edsresultsdeferred' => EDSResultsDeferred::class, |
65 | 'epfresults' => EPFResults::class, |
66 | 'epfresultsdeferred' => EPFResultsDeferred::class, |
67 | 'europeanaresults' => EuropeanaResults::class, |
68 | 'europeanaresultsdeferred' => EuropeanaResultsDeferred::class, |
69 | 'expandfacets' => ExpandFacets::class, |
70 | 'externalsearch' => ExternalSearch::class, |
71 | 'facetcloud' => FacetCloud::class, |
72 | 'favoritefacets' => FavoriteFacets::class, |
73 | 'libguidesprofile' => LibGuidesProfile::class, |
74 | 'libguidesresults' => LibGuidesResults::class, |
75 | 'libguidesresultsdeferred' => LibGuidesResultsDeferred::class, |
76 | 'libguidesazresults' => LibGuidesAZResults::class, |
77 | 'libguidesazresultsdeferred' => LibGuidesAZResultsDeferred::class, |
78 | 'libraryh3lp' => Libraryh3lp::class, |
79 | 'mapselection' => MapSelection::class, |
80 | 'sidefacets' => SideFacets::class, |
81 | 'sidefacetsdeferred' => SideFacetsDeferred::class, |
82 | 'openlibrarysubjects' => OpenLibrarySubjects::class, |
83 | 'openlibrarysubjectsdeferred' => OpenLibrarySubjectsDeferred::class, |
84 | 'pubdatevisajax' => PubDateVisAjax::class, |
85 | 'randomrecommend' => RandomRecommend::class, |
86 | 'recommendlinks' => RecommendLinks::class, |
87 | 'removefilters' => RemoveFilters::class, |
88 | 'resultgooglemapajax' => Deprecated::class, |
89 | 'spellingsuggestions' => SpellingSuggestions::class, |
90 | 'summonbestbets' => SummonBestBets::class, |
91 | 'summonbestbetsdeferred' => SummonBestBetsDeferred::class, |
92 | 'summondatabases' => SummonDatabases::class, |
93 | 'summondatabasesdeferred' => SummonDatabasesDeferred::class, |
94 | 'summonresults' => SummonResults::class, |
95 | 'summonresultsdeferred' => SummonResultsDeferred::class, |
96 | 'summontopics' => SummonTopics::class, |
97 | 'switchquery' => SwitchQuery::class, |
98 | 'switchtype' => SwitchType::class, |
99 | 'topfacets' => TopFacets::class, |
100 | 'visualfacets' => VisualFacets::class, |
101 | 'webresults' => WebResults::class, |
102 | 'worldcatidentities' => Deprecated::class, |
103 | 'worldcatterms' => Deprecated::class, |
104 | ]; |
105 | |
106 | /** |
107 | * Default plugin factories. |
108 | * |
109 | * @var array |
110 | */ |
111 | protected $factories = [ |
112 | AlphaBrowseLink::class => InvokableFactory::class, |
113 | AuthorFacets::class => InjectResultsManagerFactory::class, |
114 | AuthorInfo::class => AuthorInfoFactory::class, |
115 | AuthorityRecommend::class => InjectResultsManagerFactory::class, |
116 | CatalogResults::class => AbstractSearchObjectFactory::class, |
117 | Channels::class => InvokableFactory::class, |
118 | CollectionSideFacets::class => CollectionSideFacetsFactory::class, |
119 | ConsortialVuFind::class => ConsortialVuFindFactory::class, |
120 | ConsortialVuFindDeferred::class => InvokableFactory::class, |
121 | Databases::class => DatabasesFactory::class, |
122 | Deprecated::class => InvokableFactory::class, |
123 | DOI::class => InvokableFactory::class, |
124 | DPLATerms::class => DPLATermsFactory::class, |
125 | EDSResults::class => AbstractSearchObjectFactory::class, |
126 | EDSResultsDeferred::class => InvokableFactory::class, |
127 | EPFResults::class => AbstractSearchObjectFactory::class, |
128 | EPFResultsDeferred::class => InvokableFactory::class, |
129 | EuropeanaResults::class => EuropeanaResultsFactory::class, |
130 | EuropeanaResultsDeferred::class => InvokableFactory::class, |
131 | ExpandFacets::class => ExpandFacetsFactory::class, |
132 | ExternalSearch::class => InvokableFactory::class, |
133 | FacetCloud::class => ExpandFacetsFactory::class, |
134 | FavoriteFacets::class => FavoriteFacetsFactory::class, |
135 | LibGuidesProfile::class => LibGuidesProfileFactory::class, |
136 | LibGuidesResults::class => AbstractSearchObjectFactory::class, |
137 | LibGuidesResultsDeferred::class => InvokableFactory::class, |
138 | LibGuidesAZResults::class => AbstractSearchObjectFactory::class, |
139 | LibGuidesAZResultsDeferred::class => InvokableFactory::class, |
140 | Libraryh3lp::class => InvokableFactory::class, |
141 | MapSelection::class => MapSelectionFactory::class, |
142 | OpenLibrarySubjects::class => InvokableFactory::class, |
143 | OpenLibrarySubjectsDeferred::class => InvokableFactory::class, |
144 | PubDateVisAjax::class => InvokableFactory::class, |
145 | RandomRecommend::class => RandomRecommendFactory::class, |
146 | RecommendLinks::class => InjectConfigManagerFactory::class, |
147 | RemoveFilters::class => InvokableFactory::class, |
148 | SideFacets::class => SideFacetsFactory::class, |
149 | SideFacetsDeferred::class => SideFacetsFactory::class, |
150 | SpellingSuggestions::class => InvokableFactory::class, |
151 | SummonBestBets::class => InjectResultsManagerFactory::class, |
152 | SummonBestBetsDeferred::class => InvokableFactory::class, |
153 | SummonDatabases::class => InjectResultsManagerFactory::class, |
154 | SummonDatabasesDeferred::class => InvokableFactory::class, |
155 | SummonResults::class => AbstractSearchObjectFactory::class, |
156 | SummonResultsDeferred::class => InvokableFactory::class, |
157 | SummonTopics::class => InjectResultsManagerFactory::class, |
158 | SwitchQuery::class => SwitchQueryFactory::class, |
159 | SwitchType::class => InvokableFactory::class, |
160 | TopFacets::class => InjectConfigManagerFactory::class, |
161 | VisualFacets::class => InjectConfigManagerFactory::class, |
162 | WebResults::class => AbstractSearchObjectFactory::class, |
163 | ]; |
164 | |
165 | /** |
166 | * Constructor |
167 | * |
168 | * Make sure plugins are properly initialized. |
169 | * |
170 | * @param mixed $configOrContainerInstance Configuration or container instance |
171 | * @param array $v3config If $configOrContainerInstance is a |
172 | * container, this value will be passed to the parent constructor. |
173 | */ |
174 | public function __construct( |
175 | $configOrContainerInstance = null, |
176 | array $v3config = [] |
177 | ) { |
178 | // These objects are not meant to be shared -- every time we retrieve one, |
179 | // we are building a brand new object. |
180 | $this->sharedByDefault = false; |
181 | |
182 | $this->addAbstractFactory(PluginFactory::class); |
183 | parent::__construct($configOrContainerInstance, $v3config); |
184 | } |
185 | |
186 | /** |
187 | * Return the name of the base class or interface that plug-ins must conform |
188 | * to. |
189 | * |
190 | * @return string |
191 | */ |
192 | protected function getExpectedInterface() |
193 | { |
194 | return RecommendInterface::class; |
195 | } |
196 | } |