| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| 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 |
||
| 33 | public function buildForm() |
||
| 34 | { |
||
| 35 | $this->formBuilder |
||
| 36 | ->add( |
||
| 37 | 'view', |
||
| 38 | 'text', |
||
| 39 | array( |
||
| 40 | 'constraints' => array(new NotBlank()), |
||
| 41 | 'required' => true |
||
| 42 | ) |
||
| 43 | ) |
||
| 44 | ->add( |
||
| 45 | 'view-id', |
||
| 46 | 'text', |
||
| 47 | array( |
||
| 48 | 'constraints' => array(new NotBlank()), |
||
| 49 | 'required' => true |
||
| 50 | ) |
||
| 51 | ) |
||
| 52 | ->add( |
||
| 53 | 'url', |
||
| 54 | 'text', |
||
| 55 | array( |
||
| 56 | 'constraints' => array(new NotBlank()), |
||
| 57 | 'required' => true |
||
| 58 | ) |
||
| 59 | ) |
||
| 60 | ->add( |
||
| 61 | 'default', |
||
| 62 | 'text', |
||
| 63 | array( |
||
| 64 | 'constraints' => array(new NotBlank()), |
||
| 65 | 'required' => true |
||
| 66 | ) |
||
| 67 | ) |
||
| 68 | ->add( |
||
| 69 | 'locale', |
||
| 70 | 'text', |
||
| 71 | array( |
||
| 72 | 'constraints' => array(new NotBlank()), |
||
| 73 | 'required' => true |
||
| 74 | ) |
||
| 75 | ) |
||
| 76 | ->add( |
||
| 77 | 'httpcode', |
||
| 78 | 'text', |
||
| 79 | array( |
||
| 80 | 'constraints' => array(new NotBlank()), |
||
| 81 | 'required' => true |
||
| 82 | ) |
||
| 83 | ) |
||
| 84 | ; |
||
| 85 | } |
||
| 86 | } |
||
| 87 |