Completed
Push — master ( ccbc72...0c935c )
by Laurent
14s
created

ZoneStorageController   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 117
Duplicated Lines 95.73 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 10
Bugs 1 Features 1
Metric Value
wmc 7
c 10
b 1
f 1
lcom 0
cbo 1
dl 112
loc 117
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 6 6 1
A showAction() 6 6 1
A newAction() 10 10 1
A createAction() 11 11 1
A editAction() 10 10 1
A updateAction() 11 11 1
A deleteAction() 2 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * ZoneStorageController controller des zones de stockage.
4
 *
5
 * PHP Version 5
6
 *
7
 * @author    Quétier Laurent <[email protected]>
8
 * @copyright 2014 Dev-Int GLSR
9
 * @license   http://opensource.org/licenses/gpl-license.php GNU Public License
10
 *
11
 * @version   since 1.0.0
12
 *
13
 * @link      https://github.com/Dev-Int/glsr
14
 */
15
namespace AppBundle\Controller\Settings\Divers;
16
17
use Symfony\Component\HttpFoundation\Request;
18
use AppBundle\Controller\AbstractController;
19
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
20
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
21
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
22
use AppBundle\Entity\ZoneStorage;
23
24
/**
25
 * ZoneStorage controller.
26
 *
27
 * @category Controller
28
 *
29
 * @Route("/admin/settings/divers/zonestorage")
30
 */
31 View Code Duplication
class ZoneStorageController extends AbstractController
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
{
33
    /**
34
     * Lists all ZoneStorage entities.
35
     *
36
     * @Route("/", name="zonestorage")
37
     * @Method("GET")
38
     * @Template()
39
     */
40
    public function indexAction()
41
    {
42
        $return = $this->abstractIndexAction('ZoneStorage');
43
44
        return $return;
45
    }
46
47
    /**
48
     * Finds and displays a ZoneStorage entity.
49
     *
50
     * @Route("/{slug}/show", name="zonestorage_show")
51
     * @Method("GET")
52
     * @Template()
53
     */
54
    public function showAction(ZoneStorage $zonestorage)
55
    {
56
        $return = $this->abstractShowAction($zonestorage, 'zonestorage');
57
58
        return $return;
59
    }
60
61
    /**
62
     * Displays a form to create a new ZoneStorage entity.
63
     *
64
     * @Route("/new", name="zonestorage_new")
65
     * @Method("GET")
66
     * @Template()
67
     */
68
    public function newAction()
69
    {
70
        $return = $this->abstractNewAction(
71
            'ZoneStorage',
72
            'AppBundle\Entity\ZoneStorage',
73
            'AppBundle\Form\Type\ZoneStorageType'
74
        );
75
76
        return $return;
77
    }
78
79
    /**
80
     * Creates a new ZoneStorage entity.
81
     *
82
     * @Route("/create", name="zonestorage_create")
83
     * @Method("POST")
84
     * @Template("AppBundle:Settings/Divers/ZoneStorage:new.html.twig")
85
     */
86
    public function createAction(Request $request)
87
    {
88
        $return = $this->abstractCreateAction(
89
            $request,
90
            'zonestorage',
91
            'AppBundle\Entity\ZoneStorage',
92
            'AppBundle\Form\Type\ZoneStorageType'
93
        );
94
95
        return $return;
96
    }
97
98
    /**
99
     * Displays a form to edit an existing ZoneStorage entity.
100
     *
101
     * @Route("/{slug}/edit", name="zonestorage_edit")
102
     * @Method("GET")
103
     * @Template()
104
     */
105
    public function editAction(ZoneStorage $zonestorage)
106
    {
107
        $return = $this->abstractEditAction(
108
            $zonestorage,
109
            'zonestorage',
110
            'AppBundle\Form\Type\ZoneStorageType'
111
        );
112
113
        return $return;
114
    }
115
116
    /**
117
     * Edits an existing ZoneStorage entity.
118
     *
119
     * @Route("/{slug}/update", name="zonestorage_update")
120
     * @Method("PUT")
121
     * @Template("AppBundle:Settings/Divers/ZoneStorage:edit.html.twig")
122
     */
123
    public function updateAction(ZoneStorage $zonestorage, Request $request)
124
    {
125
        $return = $this->abstractUpdateAction(
126
            $zonestorage,
127
            $request,
128
            'zonestorage',
129
            'AppBundle\Form\Type\ZoneStorageType'
130
        );
131
132
        return $return;
133
    }
134
135
    /**
136
     * Deletes a ZoneStorage entity.
137
     *
138
     * @Route("/{id}/delete", name="zonestorage_delete", requirements={"id"="\d+"})
139
     * @Method("DELETE")
140
     */
141
    public function deleteAction(ZoneStorage $zonestorage, Request $request)
142
    {
143
        $this->abstractDeleteAction($zonestorage, $request, 'zonestorage');
144
145
        return $this->redirectToRoute('zonestorage');
146
    }
147
}
148