Completed
Push — master ( 5ea837...9dec3c )
by Paul
9s
created

AbstractPluginManagerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 9 1
1
<?php
2
/**
3
 * This file is part of the PPI Framework.
4
 *
5
 * @copyright   Copyright (c) 2011-2016 Paul Dragoonis <[email protected]>
6
 * @license     http://opensource.org/licenses/mit-license.php MIT
7
 *
8
 * @link        http://www.ppi.io
9
 */
10
11
namespace PPI\Framework\ServiceManager\Factory;
12
13
use Zend\ServiceManager\AbstractPluginManager;
14
use Zend\ServiceManager\FactoryInterface;
15
use Zend\ServiceManager\ServiceLocatorInterface;
16
17
/**
18
 * AbstractPluginManagerFactory.
19
 *
20
 * @author Vítor Brandão <[email protected]>
21
 */
22
abstract class AbstractPluginManagerFactory implements FactoryInterface
23
{
24
    const PLUGIN_MANAGER_CLASS = 'AbstractPluginManager';
25
26
    /**
27
     * Create and return a plugin manager.
28
     * Classes that extend this should provide a valid class for
29
     * the PLUGIN_MANGER_CLASS constant.
30
     *
31
     * @param ServiceLocatorInterface $serviceLocator
32
     *
33
     * @return \Zend\ServiceManager\AbstractPluginManager
34
     */
35
    public function createService(ServiceLocatorInterface $serviceLocator)
36
    {
37
        $pluginManagerClass = static::PLUGIN_MANAGER_CLASS;
38
        /* @var $plugins \Zend\ServiceManager\AbstractPluginManager */
39
        $plugins = new $pluginManagerClass();
40
        $plugins->setServiceLocator($serviceLocator);
41
42
        return $plugins;
43
    }
44
}
45