Code Duplication    Length = 17-17 lines in 2 locations

src/Controller/RefillController.php 2 locations

@@ 47-63 (lines=17) @@
44
     *
45
     * @return Response
46
     */
47
    public function refillAction($plugin, $field, Request $request)
48
    {
49
        /* @var $refiller RefillerInterface */
50
        if (!($refiller = $this->get('anime_db.plugin.refiller')->getPlugin($plugin))) {
51
            throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found');
52
        }
53
        $item = $this->createForm('entity_item', new Item())
54
            ->handleRequest($request)
55
            ->getData();
56
57
        $form = $this->getForm($field, clone $item, $refiller->refill($item, $field));
58
59
        return $this->render('AnimeDbCatalogBundle:Refill:refill.html.twig', [
60
            'field' => $field,
61
            'form' => $form->createView(),
62
        ]);
63
    }
64
65
    /**
66
     * Search for refill.
@@ 119-135 (lines=17) @@
116
     *
117
     * @return Response
118
     */
119
    public function fillFromSearchAction($plugin, $field, Request $request)
120
    {
121
        /* @var $refiller RefillerInterface */
122
        if (!($refiller = $this->get('anime_db.plugin.refiller')->getPlugin($plugin))) {
123
            throw $this->createNotFoundException('Plugin \''.$plugin.'\' is not found');
124
        }
125
        $item = $this->createForm('entity_item', new Item())
126
            ->handleRequest($request)
127
            ->getData();
128
129
        $form = $this->getForm($field, clone $item, $refiller->refillFromSearchResult($item, $field, $request->get('data')));
130
131
        return $this->render('AnimeDbCatalogBundle:Refill:refill.html.twig', [
132
            'field' => $field,
133
            'form' => $form->createView(),
134
        ]);
135
    }
136
137
    /**
138
     * Get form for field.