| Conditions | 1 |
| Paths | 1 |
| Total Lines | 81 |
| 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 |
||
| 49 | protected function buildForm() |
||
| 50 | { |
||
| 51 | $this->formBuilder |
||
| 52 | ->add("title", "text", array( |
||
| 53 | "label" => $this->translator->trans("Title", [], Dealer::MESSAGE_DOMAIN), |
||
| 54 | "label_attr" => ["for" => "dealer.title"], |
||
| 55 | "required" => true, |
||
| 56 | "constraints" => array(new NotBlank(), ), |
||
| 57 | "attr" => array() |
||
| 58 | )) |
||
| 59 | ->add("description", "text", array( |
||
| 60 | "label" => $this->translator->trans("Description", [], Dealer::MESSAGE_DOMAIN), |
||
| 61 | "label_attr" => ["for" => "dealer.description"], |
||
| 62 | "required" => false, |
||
| 63 | "attr" => array() |
||
| 64 | )) |
||
| 65 | ->add("big_description", "text", array( |
||
| 66 | "label" => $this->translator->trans("Complex Description", [], Dealer::MESSAGE_DOMAIN), |
||
| 67 | "label_attr" => ["for" => "dealer.big_description"], |
||
| 68 | "required" => false, |
||
| 69 | "attr" => array() |
||
| 70 | )) |
||
| 71 | ->add("hard_open_hour", "text", array( |
||
| 72 | "label" => $this->translator->trans("Open hour text", [], Dealer::MESSAGE_DOMAIN), |
||
| 73 | "label_attr" => ["for" => "dealer.hard_open_hour"], |
||
| 74 | "required" => false, |
||
| 75 | "attr" => array() |
||
| 76 | )) |
||
| 77 | ->add("access", "text", array( |
||
| 78 | "label" => $this->translator->trans("Access", [], Dealer::MESSAGE_DOMAIN), |
||
| 79 | "label_attr" => ["for" => "dealer.access"], |
||
| 80 | "required" => false, |
||
| 81 | "attr" => array() |
||
| 82 | )) |
||
| 83 | ->add("address1", "text", array( |
||
| 84 | "label" => $this->translator->trans("Address1", [], Dealer::MESSAGE_DOMAIN), |
||
| 85 | "label_attr" => ["for" => "dealer.address1"], |
||
| 86 | "required" => true, |
||
| 87 | "constraints" => array(new NotBlank(), ), |
||
| 88 | "attr" => array() |
||
| 89 | )) |
||
| 90 | ->add("address2", "text", array( |
||
| 91 | "label" => $this->translator->trans("Address2", [], Dealer::MESSAGE_DOMAIN), |
||
| 92 | "label_attr" => ["for" => "dealer.address2"], |
||
| 93 | "required" => false, |
||
| 94 | "attr" => array() |
||
| 95 | )) |
||
| 96 | ->add("address3", "text", array( |
||
| 97 | "label" => $this->translator->trans("Address3", [], Dealer::MESSAGE_DOMAIN), |
||
| 98 | "label_attr" => ["for" => "dealer.address3"], |
||
| 99 | "required" => false, |
||
| 100 | "attr" => array() |
||
| 101 | )) |
||
| 102 | ->add("zipcode", "text", array( |
||
| 103 | "label" => $this->translator->trans("Zipcode", [], Dealer::MESSAGE_DOMAIN), |
||
| 104 | "label_attr" => ["for" => "dealer.zipcode"], |
||
| 105 | "required" => true, |
||
| 106 | "constraints" => array(new NotBlank(), ), |
||
| 107 | "attr" => array() |
||
| 108 | )) |
||
| 109 | ->add("city", "text", array( |
||
| 110 | "label" => $this->translator->trans("City", [], Dealer::MESSAGE_DOMAIN), |
||
| 111 | "label_attr" => ["for" => "dealer.city"], |
||
| 112 | "required" => true, |
||
| 113 | "constraints" => array(new NotBlank(), ), |
||
| 114 | "attr" => array() |
||
| 115 | )) |
||
| 116 | ->add("country_id", "choice", array( |
||
| 117 | "choices" => $this->getCountries(), |
||
| 118 | "label" => $this->translator->trans("Country", [], Dealer::MESSAGE_DOMAIN), |
||
| 119 | "label_attr" => ["for" => "dealer.country"], |
||
| 120 | "required" => true, |
||
| 121 | "attr" => array() |
||
| 122 | )) |
||
| 123 | ->add("locale", "text", array( |
||
| 124 | "constraints" => array( |
||
| 125 | new NotBlank(), |
||
| 126 | ), |
||
| 127 | "label_attr" => array("for" => "locale_create"), |
||
| 128 | )); |
||
| 129 | } |
||
| 130 | |||
| 148 |