Code Duplication    Length = 15-15 lines in 2 locations

src/Kunstmaan/ArticleBundle/Twig/ArticleTwigExtension.php 2 locations

@@ 100-114 (lines=15) @@
97
     *
98
     * @return array
99
     */
100
    public function getCategories(Request $request, $className)
101
    {
102
        $context = array();
103
104
        $categoryRepository = $this->em->getRepository($className);
105
        $context['categories'] = $categoryRepository->findBy(array(), array('name' => 'ASC'));
106
107
        $searchCategory = $request->get('category') ? explode(',', $request->get('category')) : null;
108
        if ($searchCategory) {
109
            $context['activeCategory'] = true;
110
            $context['activeCategories'] = $searchCategory;
111
        }
112
113
        return $context;
114
    }
115
116
    /**
117
     * @param string $slug
@@ 76-90 (lines=15) @@
73
     *
74
     * @return array
75
     */
76
    public function getTags(Request $request, $className)
77
    {
78
        $context = array();
79
80
        $tagRepository = $this->em->getRepository($className);
81
        $context['tags'] = $tagRepository->findBy(array(), array('name' => 'ASC'));
82
83
        $searchTag = $request->get('tag') ? explode(',', $request->get('tag')) : null;
84
        if ($searchTag) {
85
            $context['activeTag'] = true;
86
            $context['activeTags'] = $searchTag;
87
        }
88
89
        return $context;
90
    }
91
92
    /**
93
     * Get categories array for view.