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 | * Database table 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 Db_Table |
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:database_gateways Wiki |
28 | */ |
29 | |
30 | namespace VuFind\Db\Table; |
31 | |
32 | /** |
33 | * Database table plugin manager |
34 | * |
35 | * @category VuFind |
36 | * @package Db_Table |
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:database_gateways Wiki |
40 | */ |
41 | class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager |
42 | { |
43 | /** |
44 | * Default plugin aliases. |
45 | * |
46 | * @var array |
47 | */ |
48 | protected $aliases = [ |
49 | 'accesstoken' => AccessToken::class, |
50 | 'authhash' => AuthHash::class, |
51 | 'changetracker' => ChangeTracker::class, |
52 | 'comments' => Comments::class, |
53 | 'externalsession' => ExternalSession::class, |
54 | 'feedback' => Feedback::class, |
55 | 'logintoken' => LoginToken::class, |
56 | 'oairesumption' => OaiResumption::class, |
57 | 'ratings' => Ratings::class, |
58 | 'record' => Record::class, |
59 | 'resource' => Resource::class, |
60 | 'resourcetags' => ResourceTags::class, |
61 | 'search' => Search::class, |
62 | 'session' => Session::class, |
63 | 'shortlinks' => Shortlinks::class, |
64 | 'tags' => Tags::class, |
65 | 'user' => User::class, |
66 | 'usercard' => UserCard::class, |
67 | 'userlist' => UserList::class, |
68 | 'userresource' => UserResource::class, |
69 | ]; |
70 | |
71 | /** |
72 | * Default plugin factories. |
73 | * |
74 | * @var array |
75 | */ |
76 | protected $factories = [ |
77 | AccessToken::class => GatewayFactory::class, |
78 | AuthHash::class => GatewayFactory::class, |
79 | ChangeTracker::class => GatewayFactory::class, |
80 | Comments::class => GatewayFactory::class, |
81 | ExternalSession::class => GatewayFactory::class, |
82 | Feedback::class => GatewayFactory::class, |
83 | LoginToken::class => GatewayFactory::class, |
84 | OaiResumption::class => GatewayFactory::class, |
85 | Ratings::class => GatewayFactory::class, |
86 | Record::class => GatewayFactory::class, |
87 | Resource::class => ResourceFactory::class, |
88 | ResourceTags::class => CaseSensitiveTagsFactory::class, |
89 | Search::class => GatewayFactory::class, |
90 | Session::class => GatewayFactory::class, |
91 | Shortlinks::class => GatewayFactory::class, |
92 | Tags::class => CaseSensitiveTagsFactory::class, |
93 | User::class => UserFactory::class, |
94 | UserCard::class => GatewayFactory::class, |
95 | UserList::class => UserListFactory::class, |
96 | UserResource::class => GatewayFactory::class, |
97 | ]; |
98 | |
99 | /** |
100 | * Constructor |
101 | * |
102 | * Make sure plugins are properly initialized. |
103 | * |
104 | * @param mixed $configOrContainerInstance Configuration or container instance |
105 | * @param array $v3config If $configOrContainerInstance is a |
106 | * container, this value will be passed to the parent constructor. |
107 | */ |
108 | public function __construct( |
109 | $configOrContainerInstance = null, |
110 | array $v3config = [] |
111 | ) { |
112 | $this->addAbstractFactory(PluginFactory::class); |
113 | parent::__construct($configOrContainerInstance, $v3config); |
114 | } |
115 | |
116 | /** |
117 | * Return the name of the base class or interface that plug-ins must conform |
118 | * to. |
119 | * |
120 | * @return string |
121 | */ |
122 | protected function getExpectedInterface() |
123 | { |
124 | return Gateway::class; |
125 | } |
126 | } |