Code Duplication    Length = 38-38 lines in 2 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/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