Conditions | 1 |
Paths | 1 |
Total Lines | 65 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
14 | public function __construct($name, AuthenticationOptionsInterface $options) |
||
15 | { |
||
16 | $this->setAuthenticationOptions($options); |
||
17 | |||
18 | parent::__construct($name); |
||
19 | |||
20 | $this->add( |
||
21 | array( |
||
22 | 'name' => 'identity', |
||
23 | 'options' => array( |
||
24 | 'label' => '', |
||
25 | ), |
||
26 | 'attributes' => array( |
||
27 | 'type' => 'hidden', |
||
28 | ), |
||
29 | ) |
||
30 | ); |
||
31 | |||
32 | $this->add( |
||
33 | array( |
||
34 | 'name' => 'newIdentity', |
||
35 | 'options' => array( |
||
36 | 'label' => 'New Email', |
||
37 | ), |
||
38 | 'attributes' => array( |
||
39 | 'type' => 'text', |
||
40 | ), |
||
41 | ) |
||
42 | ); |
||
43 | |||
44 | $this->add( |
||
45 | array( |
||
46 | 'name' => 'newIdentityVerify', |
||
47 | 'options' => array( |
||
48 | 'label' => 'Verify New Email', |
||
49 | ), |
||
50 | 'attributes' => array( |
||
51 | 'type' => 'text', |
||
52 | ), |
||
53 | ) |
||
54 | ); |
||
55 | |||
56 | $this->add( |
||
57 | array( |
||
58 | 'name' => 'credential', |
||
59 | 'type' => 'password', |
||
60 | 'options' => array( |
||
61 | 'label' => 'Password', |
||
62 | ), |
||
63 | 'attributes' => array( |
||
64 | 'type' => 'password', |
||
65 | ), |
||
66 | ) |
||
67 | ); |
||
68 | |||
69 | $this->add( |
||
70 | array( |
||
71 | 'name' => 'submit', |
||
72 | 'attributes' => array( |
||
73 | 'value' => 'Submit', |
||
74 | 'type' => 'submit' |
||
75 | ), |
||
76 | ) |
||
77 | ); |
||
78 | } |
||
79 | |||
103 |