| Conditions | 1 |
| Paths | 1 |
| Total Lines | 56 |
| Code Lines | 34 |
| 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 |
||
| 10 | public function __construct($name, AuthenticationOptionsInterface $options) |
||
| 11 | { |
||
| 12 | $this->setAuthenticationOptions($options); |
||
| 13 | parent::__construct($name); |
||
| 14 | |||
| 15 | $this->add(array( |
||
| 16 | 'name' => 'identity', |
||
| 17 | 'options' => array( |
||
| 18 | 'label' => '', |
||
| 19 | ), |
||
| 20 | 'attributes' => array( |
||
| 21 | 'type' => 'hidden', |
||
| 22 | ), |
||
| 23 | )); |
||
| 24 | |||
| 25 | $this->add(array( |
||
| 26 | 'name' => 'newIdentity', |
||
| 27 | 'options' => array( |
||
| 28 | 'label' => 'New Email', |
||
| 29 | ), |
||
| 30 | 'attributes' => array( |
||
| 31 | 'type' => 'text', |
||
| 32 | ), |
||
| 33 | )); |
||
| 34 | |||
| 35 | $this->add(array( |
||
| 36 | 'name' => 'newIdentityVerify', |
||
| 37 | 'options' => array( |
||
| 38 | 'label' => 'Verify New Email', |
||
| 39 | ), |
||
| 40 | 'attributes' => array( |
||
| 41 | 'type' => 'text', |
||
| 42 | ), |
||
| 43 | )); |
||
| 44 | |||
| 45 | $this->add(array( |
||
| 46 | 'name' => 'credential', |
||
| 47 | 'type' => 'password', |
||
| 48 | 'options' => array( |
||
| 49 | 'label' => 'Password', |
||
| 50 | ), |
||
| 51 | 'attributes' => array( |
||
| 52 | 'type' => 'password', |
||
| 53 | ), |
||
| 54 | )); |
||
| 55 | |||
| 56 | $this->add(array( |
||
| 57 | 'name' => 'submit', |
||
| 58 | 'attributes' => array( |
||
| 59 | 'value' => 'Submit', |
||
| 60 | 'type' => 'submit' |
||
| 61 | ), |
||
| 62 | )); |
||
| 63 | |||
| 64 | $this->getEventManager()->trigger('init', $this); |
||
| 65 | } |
||
| 66 | |||
| 89 |