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

ClientsForm   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 128
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 125 1
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
use Admin\Module;
20
21
class ClientsForm extends Form
22
{
23
    public function __construct($name = null)
24
    {
25
        
26
        // we want to ignore the name passed
27
        parent::__construct('clients');
28
        $oModule = new Module();
29
        $cfg = $oModule->getConfig();
0 ignored issues
show
Unused Code introduced by
$cfg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
30
        
31
        $this->setAttribute('method', 'post');
32
        $this->add(
33
            array(
34
            'name' => 'clients_id',
35
            'attributes' => array(
36
            'type'  => 'hidden',
37
            ),
38
            )
39
        );
40
        $this->add(
41
            array(
42
            'name' => 'name',
43
            'attributes' => array(
44
            'type'  => 'text',
45
            ),
46
            'options' => array(
47
            'label' => 'name',
48
            ),
49
            )
50
        );
51
        $this->add(
52
            array(
53
            'name' => 'extraname',
54
            'attributes' => array(
55
            'type'  => 'text',
56
            ),
57
            'options' => array(
58
            'label' => 'extraname',
59
            ),
60
            )
61
        );
62
        $this->add(
63
            array(
64
            'name' => 'homepage',
65
            'type'  => 'url',
66
            'attributes' => array(
67
            'type'  => 'url',
68
            ),
69
            'options' => array(
70
            'label' => 'homepage',
71
            ),
72
            )
73
        );
74
        $this->add(
75
            array(
76
            'name' => 'email',
77
            'type'  => 'email',
78
            'attributes' => array(
79
            'type'  => 'email',
80
            ),
81
            'options' => array(
82
            'label' => 'email',
83
            ),
84
            )
85
        );
86
        $this->add(
87
            array(
88
            'name' => 'contact',
89
            'attributes' => array(
90
            'type'  => 'text',
91
            ),
92
            'options' => array(
93
            'label' => 'contact',
94
            ),
95
            )
96
        );
97
        $this->add(
98
            array(
99
            'name' => 'phone',
100
            'attributes' => array(
101
            'type'  => 'text',
102
            ),
103
            'options' => array(
104
            'label' => 'phone',
105
            ),
106
            )
107
        );
108
        $this->add(
109
            array(
110
            'name' => 'statistics',
111
            'attributes' => array(
112
            'type'  => 'text',
113
            ),
114
            'options' => array(
115
            'label' => 'statistics',
116
            ),
117
            )
118
        );
119
        
120
        $this->add(
121
            array(
122
            'name' => 'submit',
123
            'attributes' => array(
124
            'type'  => 'submit',
125
            'value' => 'save',
126
            'id' => 'submitbutton',
127
            ),
128
            'options' => array(
129
            'label' => 'save',
130
            ),
131
            )
132
        );
133
        
134
        $this->add(
135
            array(
136
            'name' => 'reset',
137
            'attributes' => array(
138
            'type'  => 'reset',
139
            'value' => 'reset',
140
            'id' => 'resetbutton',
141
            ),
142
            'options' => array(
143
            'label' => 'reset',
144
            ),
145
            )
146
        );
147
    }
148
}