Conditions | 1 |
Paths | 1 |
Total Lines | 66 |
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' => 'credential', |
||
35 | 'type' => 'password', |
||
36 | 'options' => array( |
||
37 | 'label' => 'Current Password', |
||
38 | ), |
||
39 | 'attributes' => array( |
||
40 | 'type' => 'password', |
||
41 | ), |
||
42 | ) |
||
43 | ); |
||
44 | |||
45 | $this->add( |
||
46 | array( |
||
47 | 'name' => 'newCredential', |
||
48 | 'options' => array( |
||
49 | 'label' => 'New Password', |
||
50 | ), |
||
51 | 'attributes' => array( |
||
52 | 'type' => 'password', |
||
53 | ), |
||
54 | ) |
||
55 | ); |
||
56 | |||
57 | $this->add( |
||
58 | array( |
||
59 | 'name' => 'newCredentialVerify', |
||
60 | 'type' => 'password', |
||
61 | 'options' => array( |
||
62 | 'label' => 'Verify New Password', |
||
63 | ), |
||
64 | 'attributes' => array( |
||
65 | 'type' => 'password', |
||
66 | ), |
||
67 | ) |
||
68 | ); |
||
69 | |||
70 | $this->add( |
||
71 | array( |
||
72 | 'name' => 'submit', |
||
73 | 'attributes' => array( |
||
74 | 'value' => 'Submit', |
||
75 | 'type' => 'submit' |
||
76 | ), |
||
77 | ) |
||
78 | ); |
||
79 | } |
||
80 | |||
104 |