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 | * Session handler plugin manager |
5 | * |
6 | * PHP version 8 |
7 | * |
8 | * Copyright (C) Villanova University 2010, |
9 | * Leipzig University Library <info@ub.uni-leipzig.de> 2018. |
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 Session_Handlers |
26 | * @author Demian Katz <demian.katz@villanova.edu> |
27 | * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> |
28 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
29 | * @link https://vufind.org/wiki/development:plugins:session_handlers Wiki |
30 | */ |
31 | |
32 | namespace VuFind\Session; |
33 | |
34 | /** |
35 | * Session handler plugin manager |
36 | * |
37 | * @category VuFind |
38 | * @package Session_Handlers |
39 | * @author Demian Katz <demian.katz@villanova.edu> |
40 | * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> |
41 | * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
42 | * @link https://vufind.org/wiki/development:plugins:session_handlers Wiki |
43 | */ |
44 | class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager |
45 | { |
46 | /** |
47 | * Default plugin aliases. |
48 | * |
49 | * @var array |
50 | */ |
51 | protected $aliases = [ |
52 | 'database' => Database::class, |
53 | 'file' => File::class, |
54 | 'memcache' => Memcache::class, |
55 | 'redis' => Redis::class, |
56 | // for legacy 1.x compatibility |
57 | 'filesession' => File::class, |
58 | 'memcachesession' => Memcache::class, |
59 | 'mysqlsession' => Database::class, |
60 | ]; |
61 | |
62 | /** |
63 | * Default plugin factories. |
64 | * |
65 | * @var array |
66 | */ |
67 | protected $factories = [ |
68 | Database::class => AbstractBaseFactory::class, |
69 | File::class => AbstractBaseFactory::class, |
70 | Memcache::class => AbstractBaseFactory::class, |
71 | Redis::class => RedisFactory::class, |
72 | ]; |
73 | |
74 | /** |
75 | * Default delegator factories. |
76 | * |
77 | * @var string[][]|\Laminas\ServiceManager\Factory\DelegatorFactoryInterface[][] |
78 | */ |
79 | protected $delegators = [ |
80 | Database::class => [SecureDelegatorFactory::class], |
81 | File::class => [SecureDelegatorFactory::class], |
82 | Memcache::class => [SecureDelegatorFactory::class], |
83 | Redis::class => [SecureDelegatorFactory::class], |
84 | ]; |
85 | |
86 | /** |
87 | * Constructor |
88 | * |
89 | * Make sure plugins are properly initialized. |
90 | * |
91 | * @param mixed $configOrContainerInstance Configuration or container instance |
92 | * @param array $v3config If $configOrContainerInstance is a |
93 | * container, this value will be passed to the parent constructor. |
94 | */ |
95 | public function __construct( |
96 | $configOrContainerInstance = null, |
97 | array $v3config = [] |
98 | ) { |
99 | $this->addAbstractFactory(PluginFactory::class); |
100 | parent::__construct($configOrContainerInstance, $v3config); |
101 | } |
102 | |
103 | /** |
104 | * Return the name of the base class or interface that plug-ins must conform |
105 | * to. |
106 | * |
107 | * @return string |
108 | */ |
109 | protected function getExpectedInterface() |
110 | { |
111 | return HandlerInterface::class; |
112 | } |
113 | } |