Passed
Push — master ( 700b0f...aafb0a )
by Björn
18:25 queued 10s
created

AclresourceForm   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 69
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 69
loc 69
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 66 66 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
 * BB's Zend Framework 2 Components
4
 * 
5
 * AdminModule
6
 *
7
 * @package   [MyApplication]
8
 * @package   BB's Zend Framework 2 Components
9
 * @package   AdminModule
10
 * @author    Björn Bartels <[email protected]>
11
 * @link      https://gitlab.bjoernbartels.earth/groups/zf2
12
 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
13
 * @copyright copyright (c) 2016 Björn Bartels <[email protected]>
14
 */
15
16
namespace Admin\Form;
17
18
use Zend\Form\Form;
19
20 View Code Duplication
class AclresourceForm extends Form
0 ignored issues
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...
21
{
22
    public function __construct($name = null)
23
    {
24
        // we want to ignore the name passed
25
        parent::__construct('aclresource');
26
        $this->setAttribute('method', 'post');
27
        
28
        $this->add(
29
            array(
30
            'name' => 'aclresources_id',
31
            'attributes' => array(
32
            'type'  => 'hidden',
33
            ),
34
            )
35
        );
36
        $this->add(
37
            array(
38
            'name' => 'resourceslug',
39
            'type' => 'text',
40
            'attributes' => array(
41
            'type'  => 'text',
42
            ),
43
            'options' => array(
44
            'label' => 'resource slug',
45
            ),
46
            )
47
        );
48
        $this->add(
49
            array(
50
            'name' => 'resourcename',
51
            'type' => 'text',
52
            'attributes' => array(
53
            'type'  => 'text',
54
            ),
55
            'options' => array(
56
            'label' => 'resource name',
57
            ),
58
            )
59
        );
60
61
        $this->add(
62
            array(
63
            'name' => 'reset',
64
            'attributes' => array(
65
            'type'  => 'reset',
66
            'value' => 'reset',
67
            'id' => 'resetbutton',
68
            ),
69
            'options' => array(
70
            'label' => 'reset',
71
            ),
72
            )
73
        );
74
        $this->add(
75
            array(
76
            'name' => 'submit',
77
            'attributes' => array(
78
            'type'  => 'submit',
79
            'value' => 'save',
80
            'id' => 'submitbutton',
81
            ),
82
            'options' => array(
83
            'label' => 'save',
84
            ),
85
            )
86
        );
87
    }
88
}