Code Duplication    Length = 15-15 lines in 2 locations

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

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