Completed
Push — master ( 9f08b5...90d78c )
by Андрей
03:09
created

ResourceLoaderManager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 5
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 5
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/doctrine-fixture-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\DoctrineFixtureModule\ResourceLoader;
7
8
use Zend\ServiceManager\AbstractPluginManager;
9
use Zend\ServiceManager\ConfigInterface;
10
11
/**
12
 * Class ResourceLoaderManager
13
 *
14
 * @package Nnx\DoctrineFixtureModule\ResourceLoader
15
 */
16 View Code Duplication
class ResourceLoaderManager extends AbstractPluginManager implements ResourceLoaderManagerInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * Имя секции в конфиги приложения отвечающей за настройки менеджера
20
     *
21
     * @var string
22
     */
23
    const CONFIG_KEY = 'nnx_fixture_resource_loader';
24
25
    /**
26
     * @inheritDoc
27
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
28
     * @throws \Zend\ServiceManager\Exception\RuntimeException
29
     */
30
    public function __construct(ConfigInterface $configuration = null)
31
    {
32
        parent::__construct($configuration);
33
        $this->setShareByDefault(false);
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     *
39
     * @throws Exception\RuntimeException
40
     */
41
    public function validatePlugin($plugin)
42
    {
43
        if ($plugin instanceof ResourceLoaderInterface) {
44
            return;
45
        }
46
47
        throw new Exception\RuntimeException(sprintf(
48
            'Plugin of type %s is invalid; must implement %s',
49
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
50
            ResourceLoaderInterface::class
51
        ));
52
    }
53
}
54