Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
PluginManager | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
getExpectedInterface | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | /** |
4 | * Resolver driver 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 Resolver_Drivers |
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:link_resolver_drivers Wiki |
28 | */ |
29 | |
30 | namespace VuFind\Resolver\Driver; |
31 | |
32 | use Laminas\ServiceManager\Factory\InvokableFactory; |
33 | |
34 | /** |
35 | * Resolver driver plugin manager |
36 | * |
37 | * @category VuFind |
38 | * @package Resolver_Drivers |
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:link_resolver_drivers Wiki |
42 | */ |
43 | class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager |
44 | { |
45 | /** |
46 | * Default plugin aliases. |
47 | * |
48 | * @var array |
49 | */ |
50 | protected $aliases = [ |
51 | '360link' => Threesixtylink::class, |
52 | 'alma' => Alma::class, |
53 | 'demo' => Demo::class, |
54 | 'ezb' => Jop::class, |
55 | 'jop' => Jop::class, |
56 | 'sfx' => Sfx::class, |
57 | 'redi' => Redi::class, |
58 | 'threesixtylink' => Threesixtylink::class, |
59 | 'generic' => Generic::class, |
60 | 'other' => 'generic', |
61 | ]; |
62 | |
63 | /** |
64 | * Default plugin factories. |
65 | * |
66 | * @var array |
67 | */ |
68 | protected $factories = [ |
69 | Alma::class => AlmaFactory::class, |
70 | Threesixtylink::class => DriverWithHttpClientFactory::class, |
71 | Demo::class => InvokableFactory::class, |
72 | Jop::class => JopFactory::class, |
73 | Sfx::class => DriverWithHttpClientFactory::class, |
74 | Redi::class => DriverWithHttpClientFactory::class, |
75 | Generic::class => AbstractBaseFactory::class, |
76 | ]; |
77 | |
78 | /** |
79 | * Constructor |
80 | * |
81 | * Make sure plugins are properly initialized. |
82 | * |
83 | * @param mixed $configOrContainerInstance Configuration or container instance |
84 | * @param array $v3config If $configOrContainerInstance is a |
85 | * container, this value will be passed to the parent constructor. |
86 | */ |
87 | public function __construct( |
88 | $configOrContainerInstance = null, |
89 | array $v3config = [] |
90 | ) { |
91 | $this->addAbstractFactory(PluginFactory::class); |
92 | parent::__construct($configOrContainerInstance, $v3config); |
93 | } |
94 | |
95 | /** |
96 | * Return the name of the base class or interface that plug-ins must conform |
97 | * to. |
98 | * |
99 | * @return string |
100 | */ |
101 | protected function getExpectedInterface() |
102 | { |
103 | return DriverInterface::class; |
104 | } |
105 | } |