Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
PluginManager
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getExpectedInterface
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Auth handler 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  Authentication
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 Wiki
28 */
29
30namespace VuFind\Auth;
31
32use Laminas\ServiceManager\Factory\InvokableFactory;
33
34/**
35 * Auth handler plugin manager
36 *
37 * @category VuFind
38 * @package  Authentication
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 Wiki
42 */
43class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
44{
45    /**
46     * Default plugin aliases.
47     *
48     * @var array
49     */
50    protected $aliases = [
51        'almadatabase' => AlmaDatabase::class,
52        'cas' => CAS::class,
53        'choiceauth' => ChoiceAuth::class,
54        'database' => Database::class,
55        'email' => Email::class,
56        'facebook' => Facebook::class,
57        'ils' => ILS::class,
58        'ldap' => LDAP::class,
59        'multiauth' => MultiAuth::class,
60        'multiils' => MultiILS::class,
61        'shibboleth' => Shibboleth::class,
62        'simulatedsso' => SimulatedSSO::class,
63        'sip2' => SIP2::class,
64        // for legacy 1.x compatibility
65        'db' => Database::class,
66        'sip' => SIP2::class,
67    ];
68
69    /**
70     * Default plugin factories.
71     *
72     * @var array
73     */
74    protected $factories = [
75        AlmaDatabase::class => ILSFactory::class,
76        CAS::class => CASFactory::class,
77        ChoiceAuth::class => ChoiceAuthFactory::class,
78        Database::class => InvokableFactory::class,
79        Email::class => EmailFactory::class,
80        Facebook::class => FacebookFactory::class,
81        ILS::class => ILSFactory::class,
82        LDAP::class => LDAPFactory::class,
83        MultiAuth::class => MultiAuthFactory::class,
84        MultiILS::class => ILSFactory::class,
85        Shibboleth::class => ShibbolethFactory::class,
86        SimulatedSSO::class => SimulatedSSOFactory::class,
87        SIP2::class => SIP2Factory::class,
88    ];
89
90    /**
91     * Constructor
92     *
93     * Make sure plugins are properly initialized.
94     *
95     * @param mixed $configOrContainerInstance Configuration or container instance
96     * @param array $v3config                  If $configOrContainerInstance is a
97     * container, this value will be passed to the parent constructor.
98     */
99    public function __construct(
100        $configOrContainerInstance = null,
101        array $v3config = []
102    ) {
103        $this->addAbstractFactory(PluginFactory::class);
104        parent::__construct($configOrContainerInstance, $v3config);
105    }
106
107    /**
108     * Return the name of the base class or interface that plug-ins must conform
109     * to.
110     *
111     * @return string
112     */
113    protected function getExpectedInterface()
114    {
115        return AbstractBase::class;
116    }
117}