Code Duplication    Length = 38-38 lines in 4 locations

src/Filter/FixtureFilterManager.php 1 location

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

src/FixtureInitializer/FixtureInitializerManager.php 1 location

@@ 16-53 (lines=38) @@
13
 *
14
 * @package Nnx\DoctrineFixtureModule\FixtureInitializer
15
 */
16
class FixtureInitializerManager extends AbstractPluginManager implements FixtureInitializerManagerInterface
17
{
18
    /**
19
     * Имя секции в конфиги приложения отвечающей за настройки менеджера
20
     *
21
     * @var string
22
     */
23
    const CONFIG_KEY = 'nnx_fixture_initializer';
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 FixtureInitializerInterface) {
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
            FixtureInitializerInterface::class
51
        ));
52
    }
53
}
54

src/Loader/FixtureLoaderManager.php 1 location

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

src/ResourceLoader/ResourceLoaderManager.php 1 location

@@ 16-53 (lines=38) @@
13
 *
14
 * @package Nnx\DoctrineFixtureModule\ResourceLoader
15
 */
16
class ResourceLoaderManager extends AbstractPluginManager implements ResourceLoaderManagerInterface
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