Code Duplication    Length = 7-7 lines in 2 locations

src/Dragon/Controller/DragonApiController.php 2 locations

@@ 54-60 (lines=7) @@
51
        $form = new DragonForm('create');
52
        $form->populate($post);
53
54
        if ($form->isValid()) {
55
            $data = $form->getValues();
56
            $dragon = $this->service->createFromArray($data);
57
            $this->service->saveDragon($dragon);
58
59
            return new JsonResponse($dragon->toArray());
60
        }
61
62
        return new JsonResponse([
63
            'error' => [
@@ 99-105 (lines=7) @@
96
        $form = new DragonForm('update');
97
        $form->populate($post);
98
99
        if ($form->isValid()) {
100
            $data = $form->getValues();
101
            $dragon = $this->service->updateFromArray($dragon, $data);
102
            $this->service->saveDragon($dragon);
103
104
            return new JsonResponse($dragon->toArray());
105
        }
106
107
        return new JsonResponse([
108
            'error' => [