Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
PluginManager
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getExpectedInterface
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Sitemap generator plugin manager
5 *
6 * PHP version 8
7 *
8 * Copyright (C) The National Library of Finland 2021.
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  Sitemap
25 * @author   Ere Maijala <ere.maijala@helsinki.fi>
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\Sitemap;
31
32use Laminas\ServiceManager\Factory\InvokableFactory;
33
34/**
35 * Sitemap generator plugin manager
36 *
37 * @category VuFind
38 * @package  Sitemap
39 * @author   Ere Maijala <ere.maijala@helsinki.fi>
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        'ContentPages' => Plugin\ContentPages::class,
52        'Index' => Plugin\Index::class,
53        'StartPage' => Plugin\StartPage::class,
54    ];
55
56    /**
57     * Default plugin factories.
58     *
59     * @var array
60     */
61    protected $factories = [
62        Plugin\ContentPages::class => Plugin\ContentPagesFactory::class,
63        Plugin\Index::class => Plugin\IndexFactory::class,
64        Plugin\StartPage::class => InvokableFactory::class,
65    ];
66
67    /**
68     * Constructor
69     *
70     * Make sure plugins are properly initialized.
71     *
72     * @param mixed $configOrContainerInstance Configuration or container instance
73     * @param array $v3config                  If $configOrContainerInstance is a
74     * container, this value will be passed to the parent constructor.
75     */
76    public function __construct(
77        $configOrContainerInstance = null,
78        array $v3config = []
79    ) {
80        $this->addAbstractFactory(PluginFactory::class);
81        parent::__construct($configOrContainerInstance, $v3config);
82    }
83
84    /**
85     * Return the name of the base class or interface that plug-ins must conform
86     * to.
87     *
88     * @return string
89     */
90    protected function getExpectedInterface()
91    {
92        return Plugin\GeneratorPluginInterface::class;
93    }
94}