Code Duplication    Length = 19-20 lines in 2 locations

Controller/AdminBlockController.php 1 location

@@ 16-34 (lines=19) @@
13
    private $_cmsContentParameter = null;
14
    private $_blockDefaultClass = 'Alpixel\Bundle\CMSBundle\Entity\Block';
15
16
    public function editContentAction()
17
    {
18
        $object = $this->admin->getSubject();
19
        if (!$object) {
20
            throw new NotFoundHttpException(sprintf('unable to find the object'));
21
        }
22
23
        $content = $this->findContent();
24
25
        if ($content !== null) {
26
            $instanceAdmin = $this->admin->getConfigurationPool()->getAdminByClass($className);
27
28
            if ($instanceAdmin !== null) {
29
                return $this->redirect($instanceAdmin->generateUrl('edit', ['id' => $content->getId()]));
30
            }
31
        }
32
33
        throw new NotFoundHttpException(sprintf('unable to find a class admin for the %s class', get_class($content)));
34
    }
35
36
    private function findContent()
37
    {

Controller/AdminNodeController.php 1 location

@@ 12-31 (lines=20) @@
9
10
class AdminNodeController extends Controller
11
{
12
    public function editContentAction()
13
    {
14
        $object = $this->admin->getSubject();
15
16
        if (!$object) {
17
            throw new NotFoundHttpException(sprintf('unable to find the object'));
18
        }
19
20
        $content = $this->get('cms.helper')->getNodeElementEntityFromNode($object);
21
22
        if ($content !== null) {
23
            $instanceAdmin = $this->admin->getConfigurationPool()->getAdminByClass(get_class($content));
24
25
            if ($instanceAdmin !== null) {
26
                return $this->redirect($instanceAdmin->generateUrl('edit', ['id' => $content->getId()]));
27
            }
28
        }
29
30
        throw new NotFoundHttpException(sprintf('unable to find a class admin for the %s class', $contentType['class']));
31
    }
32
33
    public function createTranslationAction(Request $request)
34
    {