Code Duplication    Length = 12-13 lines in 2 locations

Bundle/MediaBundle/Helper/Menu/MediaMenuAdaptor.php 2 locations

@@ 55-67 (lines=13) @@
52
            $galleries = $this->em->getRepository('VictoireMediaBundle:Folder')->getAllFolders();
53
            $currentId = $request->get('folderId');
54
55
            if (isset($currentId)) {
56
                /* @var \Victoire\Bundle\MediaBundle\Entity\Folder $currentFolder */
57
                $currentFolder = $this->em->getRepository('VictoireMediaBundle:Folder')->findOneById($currentId);
58
            } elseif (in_array($request->attributes->get('_route'), $mediaRoutes)) {
59
                /* @var \Victoire\Bundle\MediaBundle\Entity\Media $media */
60
                $media = $this->em->getRepository('VictoireMediaBundle:Media')->getMedia($request->get('mediaId'));
61
                $currentFolder = $media->getFolder();
62
            } elseif (in_array($request->attributes->get('_route'), $createRoutes)) {
63
                $currentId = $request->get('folderId');
64
                if (isset($currentId)) {
65
                    $currentFolder = $this->em->getRepository('VictoireMediaBundle:Folder')->findOneById($currentId);
66
                }
67
            }
68
69
            if (isset($currentFolder)) {
70
                $parents = $currentFolder->getParents();
@@ 104-115 (lines=12) @@
101
            $galleries = $parentFolder->getChildren();
102
            $currentId = $request->get('folderId');
103
104
            if (isset($currentId)) {
105
                /* @var \Victoire\Bundle\MediaBundle\Entity\Folder $currentFolder */
106
                $currentFolder = $this->em->getRepository('VictoireMediaBundle:Folder')->findOneById($currentId);
107
            } elseif (in_array($request->attributes->get('_route'), $mediaRoutes)) {
108
                $media = $this->em->getRepository('VictoireMediaBundle:Media')->getMedia($request->get('mediaId'));
109
                $currentFolder = $media->getFolder();
110
            } elseif (in_array($request->attributes->get('_route'), $createRoutes)) {
111
                $currentId = $request->get('folderId');
112
                if (isset($currentId)) {
113
                    $currentFolder = $this->em->getRepository('VictoireMediaBundle:Folder')->findOneById($currentId);
114
                }
115
            }
116
117
            /* @var \Victoire\Bundle\MediaBundle\Entity\Folder[] $parentGalleries */
118
            $parentGalleries = null;