Code Duplication    Length = 7-7 lines in 2 locations

Controller/AdminBlockController.php 1 location

@@ 49-55 (lines=7) @@
46
            $className = $this->_blockDefaultClass;
47
        }
48
49
        if ($content !== null) {
50
            $instanceAdmin = $this->admin->getConfigurationPool()->getAdminByClass($className);
51
52
            if ($instanceAdmin !== null) {
53
                return $this->redirect($instanceAdmin->generateUrl('edit', ['id' => $content->getId()]));
54
            }
55
        }
56
57
        throw new NotFoundHttpException(sprintf('unable to find a class admin for the %s class', get_class($content)));
58
    }

Controller/AdminNodeController.php 1 location

@@ 23-29 (lines=7) @@
20
21
        $content = $this->get('cms.helper')->getNodeElementEntityFromNode($object);
22
23
        if ($content !== null) {
24
            $instanceAdmin = $this->admin->getConfigurationPool()->getAdminByClass(get_class($content));
25
26
            if ($instanceAdmin !== null) {
27
                return $this->redirect($instanceAdmin->generateUrl('edit', ['id' => $content->getId()]));
28
            }
29
        }
30
31
        throw new NotFoundHttpException(sprintf('unable to find a class admin for the %s class', $contentType['class']));
32
    }