Code Duplication    Length = 18-18 lines in 2 locations

src/ObjectManager/ObjectManagerAutoDetector.php 2 locations

@@ 43-60 (lines=18) @@
40
     *
41
     * @throws Exception\RuntimeException
42
     */
43
    public function getObjectManagerNameByClassName($className)
44
    {
45
        $moduleOptions = $this->getModuleOptionsManager()->getOptionsByClassName($className);
46
47
        if (!$moduleOptions instanceof ObjectManagerNameProviderInterface) {
48
            $errMsg = sprintf('Module options not implement %s', ObjectManagerNameProviderInterface::class);
49
            throw new Exception\RuntimeException($errMsg);
50
        }
51
52
        $objectManagerName = $moduleOptions->getObjectManagerName();
53
54
        if (!is_string($objectManagerName)) {
55
            $errMsg = 'Invalid object manager name. Manager name not string';
56
            throw new Exception\RuntimeException($errMsg);
57
        }
58
59
        return $objectManagerName;
60
    }
61
62
63
    /**
@@ 70-87 (lines=18) @@
67
     *
68
     * @return boolean
69
     */
70
    public function hasObjectManagerNameByClassName($className)
71
    {
72
        $moduleOptions = $this->getModuleOptionsManager()->getOptionsByClassName($className);
73
74
        if (!$moduleOptions instanceof ObjectManagerNameProviderInterface) {
75
            $errMsg = sprintf('Module options not implement %s', ObjectManagerNameProviderInterface::class);
76
            throw new Exception\RuntimeException($errMsg);
77
        }
78
79
        $objectManagerName = $moduleOptions->getObjectManagerName();
80
81
        if (!is_string($objectManagerName)) {
82
            $errMsg = 'Invalid object manager name. Manager name not string';
83
            throw new Exception\RuntimeException($errMsg);
84
        }
85
86
        return $objectManagerName;
87
    }
88
89
90