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 * ILS 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  ILS_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:ils_drivers Wiki
28 */
29
30namespace VuFind\ILS\Driver;
31
32use Laminas\ServiceManager\Factory\InvokableFactory;
33
34/**
35 * ILS driver plugin manager
36 *
37 * @category VuFind
38 * @package  ILS_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:ils_drivers Wiki
42 */
43class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
44{
45    /**
46     * Default plugin aliases.
47     *
48     * @var array
49     */
50    protected $aliases = [
51        'aleph' => Aleph::class,
52        'alma' => Alma::class,
53        'amicus' => Amicus::class,
54        'composeddriver' => ComposedDriver::class,
55        'daia' => DAIA::class,
56        'demo' => Demo::class,
57        'evergreen' => Evergreen::class,
58        'folio' => Folio::class,
59        'genieplus' => GeniePlus::class,
60        'horizon' => Horizon::class,
61        'horizonxmlapi' => HorizonXMLAPI::class,
62        'innovative' => Innovative::class,
63        'koha' => Koha::class,
64        'kohailsdi' => KohaILSDI::class,
65        'koharest' => KohaRest::class,
66        'multibackend' => MultiBackend::class,
67        'newgenlib' => NewGenLib::class,
68        'noils' => NoILS::class,
69        'paia' => PAIA::class,
70        'polaris' => Polaris::class,
71        'sample' => Sample::class,
72        'sierrarest' => SierraRest::class,
73        'symphony' => Symphony::class,
74        'unicorn' => Unicorn::class,
75        'virtua' => Virtua::class,
76        'voyager' => Voyager::class,
77        'voyagerrestful' => VoyagerRestful::class,
78        'xcncip2' => XCNCIP2::class,
79    ];
80
81    /**
82     * Default plugin factories.
83     *
84     * @var array
85     */
86    protected $factories = [
87        Aleph::class => AlephFactory::class,
88        Alma::class => DriverWithDateConverterFactory::class,
89        Amicus::class => InvokableFactory::class,
90        ComposedDriver::class => AbstractMultiDriverFactory::class,
91        DAIA::class => DriverWithDateConverterFactory::class,
92        Demo::class => DemoFactory::class,
93        Evergreen::class => DriverWithDateConverterFactory::class,
94        Folio::class => FolioFactory::class,
95        GeniePlus::class => GeniePlusFactory::class,
96        Horizon::class => DriverWithDateConverterFactory::class,
97        HorizonXMLAPI::class => DriverWithDateConverterFactory::class,
98        Innovative::class => InvokableFactory::class,
99        Koha::class => DriverWithDateConverterFactory::class,
100        KohaILSDI::class => DriverWithDateConverterFactory::class,
101        KohaRest::class => KohaRestFactory::class,
102        MultiBackend::class => MultiBackendFactory::class,
103        NewGenLib::class => InvokableFactory::class,
104        NoILS::class => NoILSFactory::class,
105        PAIA::class => PAIAFactory::class,
106        Polaris::class => InvokableFactory::class,
107        Sample::class => InvokableFactory::class,
108        SierraRest::class => SierraRestFactory::class,
109        Symphony::class => SymphonyFactory::class,
110        Unicorn::class => UnicornFactory::class,
111        Virtua::class => InvokableFactory::class,
112        Voyager::class => DriverWithDateConverterFactory::class,
113        VoyagerRestful::class => VoyagerRestfulFactory::class,
114        XCNCIP2::class => XCNCIP2Factory::class,
115    ];
116
117    /**
118     * Constructor
119     *
120     * Make sure plugins are properly initialized.
121     *
122     * @param mixed $configOrContainerInstance Configuration or container instance
123     * @param array $v3config                  If $configOrContainerInstance is a
124     * container, this value will be passed to the parent constructor.
125     */
126    public function __construct(
127        $configOrContainerInstance = null,
128        array $v3config = []
129    ) {
130        $this->addAbstractFactory(PluginFactory::class);
131        parent::__construct($configOrContainerInstance, $v3config);
132    }
133
134    /**
135     * Return the name of the base class or interface that plug-ins must conform
136     * to.
137     *
138     * @return string
139     */
140    protected function getExpectedInterface()
141    {
142        return DriverInterface::class;
143    }
144}