Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
SolrFactory | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
__invoke | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | /** |
4 | * Factory for Solr-driven autocomplete plugins. Works for \VuFind\Autocomplete\Solr |
5 | * and all of its subclasses. |
6 | * |
7 | * PHP version 8 |
8 | * |
9 | * Copyright (C) Villanova University 2017. |
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 Autocomplete |
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/wiki/development Wiki |
29 | */ |
30 | |
31 | namespace VuFind\Autocomplete; |
32 | |
33 | use Laminas\ServiceManager\Exception\ServiceNotCreatedException; |
34 | use Laminas\ServiceManager\Exception\ServiceNotFoundException; |
35 | use Psr\Container\ContainerExceptionInterface as ContainerException; |
36 | use Psr\Container\ContainerInterface; |
37 | |
38 | /** |
39 | * Factory for Solr-driven autocomplete plugins. Works for \VuFind\Autocomplete\Solr |
40 | * and all of its subclasses. |
41 | * |
42 | * @category VuFind |
43 | * @package Autocomplete |
44 | * @author Demian Katz <demian.katz@villanova.edu> |
45 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
46 | * @link https://vufind.org/wiki/development Wiki |
47 | */ |
48 | class SolrFactory implements \Laminas\ServiceManager\Factory\FactoryInterface |
49 | { |
50 | /** |
51 | * Create an object |
52 | * |
53 | * @param ContainerInterface $container Service manager |
54 | * @param string $requestedName Service being created |
55 | * @param null|array $options Extra options (optional) |
56 | * |
57 | * @return object |
58 | * |
59 | * @throws ServiceNotFoundException if unable to resolve the service. |
60 | * @throws ServiceNotCreatedException if an exception is raised when |
61 | * creating a service. |
62 | * @throws ContainerException&\Throwable if any other error occurs |
63 | * |
64 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) |
65 | */ |
66 | public function __invoke( |
67 | ContainerInterface $container, |
68 | $requestedName, |
69 | array $options = null |
70 | ) { |
71 | return new $requestedName( |
72 | $container->get(\VuFind\Search\Results\PluginManager::class) |
73 | ); |
74 | } |
75 | } |