Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
PluginManager
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
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 * Record tab 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  RecordTabs
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:record_tabs Wiki
28 */
29
30namespace VuFind\RecordTab;
31
32use Laminas\ServiceManager\Factory\InvokableFactory;
33
34/**
35 * Record tab plugin manager
36 *
37 * @category VuFind
38 * @package  RecordTabs
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:record_tabs Wiki
42 */
43class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager
44{
45    /**
46     * Default plugin aliases.
47     *
48     * @var array
49     */
50    protected $aliases = [
51        'collectionhierarchytree' => CollectionHierarchyTree::class,
52        'collectionlist' => CollectionList::class,
53        'componentparts' => ComponentParts::class,
54        'description' => Description::class,
55        'excerpt' => Excerpt::class,
56        'formats' => Formats::class,
57        'hierarchytree' => HierarchyTree::class,
58        'holdingsils' => HoldingsILS::class,
59        'holdingsworldcat' => HoldingsWorldCat::class,
60        'map' => Map::class,
61        'preview' => Preview::class,
62        'reviews' => Reviews::class,
63        'search2collectionlist' => Search2CollectionList::class,
64        'similaritemscarousel' => SimilarItemsCarousel::class,
65        'staffviewarray' => StaffViewArray::class,
66        'staffviewmarc' => StaffViewMARC::class,
67        'staffviewoverdrive' => StaffViewOverdrive::class,
68        'toc' => TOC::class,
69        'usercomments' => UserComments::class,
70        'versions' => Versions::class,
71    ];
72
73    /**
74     * Default plugin factories.
75     *
76     * @var array
77     */
78    protected $factories = [
79        CollectionHierarchyTree::class => CollectionHierarchyTreeFactory::class,
80        CollectionList::class => CollectionListFactory::class,
81        ComponentParts::class => ComponentPartsFactory::class,
82        Description::class => InvokableFactory::class,
83        Excerpt::class => ExcerptFactory::class,
84        Formats::class => InvokableFactory::class,
85        HierarchyTree::class => HierarchyTreeFactory::class,
86        HoldingsILS::class => HoldingsILSFactory::class,
87        HoldingsWorldCat::class => HoldingsWorldCatFactory::class,
88        Map::class => MapFactory::class,
89        OverdriveHoldings::class => InvokableFactory::class,
90        Preview::class => PreviewFactory::class,
91        Reviews::class => ReviewsFactory::class,
92        Search2CollectionList::class => CollectionListFactory::class,
93        SimilarItemsCarousel::class => SimilarItemsCarouselFactory::class,
94        StaffViewArray::class => InvokableFactory::class,
95        StaffViewMARC::class => InvokableFactory::class,
96        StaffViewOverdrive::class => InvokableFactory::class,
97        TOC::class => TOCFactory::class,
98        UserComments::class => UserCommentsFactory::class,
99        Versions::class => VersionsFactory::class,
100    ];
101
102    /**
103     * Constructor
104     *
105     * Make sure plugins are properly initialized.
106     *
107     * @param mixed $configOrContainerInstance Configuration or container instance
108     * @param array $v3config                  If $configOrContainerInstance is a
109     * container, this value will be passed to the parent constructor.
110     */
111    public function __construct(
112        $configOrContainerInstance = null,
113        array $v3config = []
114    ) {
115        $this->addAbstractFactory(PluginFactory::class);
116        $this->addInitializer(
117            \LmcRbacMvc\Initializer\AuthorizationServiceInitializer::class
118        );
119        parent::__construct($configOrContainerInstance, $v3config);
120    }
121
122    /**
123     * Return the name of the base class or interface that plug-ins must conform
124     * to.
125     *
126     * @return string
127     */
128    protected function getExpectedInterface()
129    {
130        return TabInterface::class;
131    }
132}