| Conditions | 1 |
| Paths | 1 |
| Total Lines | 57 |
| Code Lines | 35 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 1 | Features | 1 |
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 |
||
| 15 | public function __construct($name, AuthenticationOptionsInterface $options) |
||
| 16 | { |
||
| 17 | $this->setAuthenticationOptions($options); |
||
| 18 | parent::__construct($name); |
||
| 19 | |||
| 20 | $this->add(array( |
||
| 21 | 'name' => 'identity', |
||
| 22 | 'options' => array( |
||
| 23 | 'label' => '', |
||
| 24 | ), |
||
| 25 | 'attributes' => array( |
||
| 26 | 'type' => 'hidden' |
||
| 27 | ), |
||
| 28 | )); |
||
| 29 | |||
| 30 | $this->add(array( |
||
| 31 | 'name' => 'credential', |
||
| 32 | 'type' => 'password', |
||
| 33 | 'options' => array( |
||
| 34 | 'label' => 'Current Password', |
||
| 35 | ), |
||
| 36 | 'attributes' => array( |
||
| 37 | 'type' => 'password', |
||
| 38 | ), |
||
| 39 | )); |
||
| 40 | |||
| 41 | $this->add(array( |
||
| 42 | 'name' => 'newCredential', |
||
| 43 | 'options' => array( |
||
| 44 | 'label' => 'New Password', |
||
| 45 | ), |
||
| 46 | 'attributes' => array( |
||
| 47 | 'type' => 'password', |
||
| 48 | ), |
||
| 49 | )); |
||
| 50 | |||
| 51 | $this->add(array( |
||
| 52 | 'name' => 'newCredentialVerify', |
||
| 53 | 'type' => 'password', |
||
| 54 | 'options' => array( |
||
| 55 | 'label' => 'Verify New Password', |
||
| 56 | ), |
||
| 57 | 'attributes' => array( |
||
| 58 | 'type' => 'password', |
||
| 59 | ), |
||
| 60 | )); |
||
| 61 | |||
| 62 | $this->add(array( |
||
| 63 | 'name' => 'submit', |
||
| 64 | 'attributes' => array( |
||
| 65 | 'value' => 'Submit', |
||
| 66 | 'type' => 'submit' |
||
| 67 | ), |
||
| 68 | )); |
||
| 69 | |||
| 70 | $this->getEventManager()->trigger('init', $this); |
||
| 71 | } |
||
| 72 | |||
| 95 |