| Conditions | 1 |
| Paths | 1 |
| Total Lines | 185 |
| Code Lines | 127 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 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 |
||
| 18 | public function __construct(ContainerInterface $di) |
||
| 19 | { |
||
| 20 | parent::__construct($di); |
||
| 21 | $this->form->create( |
||
| 22 | [ |
||
| 23 | "id" => __CLASS__, |
||
| 24 | "legend" => "Legend", |
||
| 25 | ], |
||
| 26 | [ |
||
| 27 | "text" => [ |
||
| 28 | "type" => "text", |
||
| 29 | "description" => "Here you can place a description.", |
||
| 30 | "placeholder" => "Here is a placeholder", |
||
| 31 | ], |
||
| 32 | |||
| 33 | "password" => [ |
||
| 34 | "type" => "password", |
||
| 35 | "description" => "Here you can place a description.", |
||
| 36 | "placeholder" => "Here is a placeholder", |
||
| 37 | ], |
||
| 38 | |||
| 39 | "hidden" => [ |
||
| 40 | "type" => "hidden", |
||
| 41 | "value" => "secret value", |
||
| 42 | ], |
||
| 43 | |||
| 44 | "file" => [ |
||
| 45 | "type" => "file", |
||
| 46 | "description" => "Here you can place a description.", |
||
| 47 | ], |
||
| 48 | |||
| 49 | "textarea" => [ |
||
| 50 | "type" => "textarea", |
||
| 51 | "description" => "Here you can place a description.", |
||
| 52 | "placeholder" => "Here is a placeholder", |
||
| 53 | ], |
||
| 54 | |||
| 55 | "radio" => [ |
||
| 56 | "type" => "radio", |
||
| 57 | "label" => "What is your preferred choice of fruite?", |
||
| 58 | "description" => "Here you can place a description.", |
||
| 59 | "values" => [ |
||
| 60 | "tomato", |
||
| 61 | "potato", |
||
| 62 | "apple", |
||
| 63 | "pear", |
||
| 64 | "banana" |
||
| 65 | ], |
||
| 66 | "checked" => "potato", |
||
| 67 | ], |
||
| 68 | |||
| 69 | "checkbox" => [ |
||
| 70 | "type" => "checkbox", |
||
| 71 | "description" => "Here you can place a description.", |
||
| 72 | ], |
||
| 73 | |||
| 74 | "select" => [ |
||
| 75 | "type" => "select", |
||
| 76 | "label" => "Select your fruite:", |
||
| 77 | "description" => "Here you can place a description.", |
||
| 78 | "options" => [ |
||
| 79 | "tomato" => "tomato", |
||
| 80 | "potato" => "potato", |
||
| 81 | "apple" => "apple", |
||
| 82 | "pear" => "pear", |
||
| 83 | "banana" => "banana", |
||
| 84 | ], |
||
| 85 | "value" => "potato", |
||
| 86 | ], |
||
| 87 | |||
| 88 | "selectm" => [ |
||
| 89 | "type" => "select-multiple", |
||
| 90 | "label" => "Select one or more fruite:", |
||
| 91 | "description" => "Here you can place a description.", |
||
| 92 | "size" => 6, |
||
| 93 | "options" => [ |
||
| 94 | "tomato" => "tomato", |
||
| 95 | "potato" => "potato", |
||
| 96 | "apple" => "apple", |
||
| 97 | "pear" => "pear", |
||
| 98 | "banana" => "banana", |
||
| 99 | ], |
||
| 100 | "checked" => ["potato", "pear"], |
||
| 101 | ], |
||
| 102 | |||
| 103 | "color" => [ |
||
| 104 | "type" => "color", |
||
| 105 | "description" => "Here you can place a description.", |
||
| 106 | "placeholder" => "Here is a placeholder", |
||
| 107 | ], |
||
| 108 | |||
| 109 | "date" => [ |
||
| 110 | "type" => "date", |
||
| 111 | "description" => "Here you can place a description.", |
||
| 112 | "placeholder" => "Here is a placeholder", |
||
| 113 | ], |
||
| 114 | |||
| 115 | "datetime" => [ |
||
| 116 | "type" => "datetime", |
||
| 117 | "description" => "Here you can place a description.", |
||
| 118 | "placeholder" => "Here is a placeholder", |
||
| 119 | ], |
||
| 120 | |||
| 121 | "datetime-local" => [ |
||
| 122 | "type" => "datetime-local", |
||
| 123 | "description" => "Here you can place a description.", |
||
| 124 | "placeholder" => "Here is a placeholder", |
||
| 125 | ], |
||
| 126 | |||
| 127 | "time" => [ |
||
| 128 | "type" => "time", |
||
| 129 | "description" => "Here you can place a description.", |
||
| 130 | "placeholder" => "Here is a placeholder", |
||
| 131 | ], |
||
| 132 | |||
| 133 | "week" => [ |
||
| 134 | "type" => "week", |
||
| 135 | "description" => "Here you can place a description.", |
||
| 136 | "placeholder" => "Here is a placeholder", |
||
| 137 | ], |
||
| 138 | |||
| 139 | "month" => [ |
||
| 140 | "type" => "month", |
||
| 141 | "description" => "Here you can place a description.", |
||
| 142 | "placeholder" => "Here is a placeholder", |
||
| 143 | ], |
||
| 144 | |||
| 145 | "number" => [ |
||
| 146 | "type" => "number", |
||
| 147 | "description" => "Here you can place a description.", |
||
| 148 | "placeholder" => "Here is a placeholder", |
||
| 149 | ], |
||
| 150 | |||
| 151 | "range" => [ |
||
| 152 | "type" => "range", |
||
| 153 | "description" => "Here you can place a description.", |
||
| 154 | "placeholder" => "Here is a placeholder", |
||
| 155 | "value" => 42, |
||
| 156 | "min" => 0, |
||
| 157 | "max" => 100, |
||
| 158 | "step" => 2, |
||
| 159 | ], |
||
| 160 | |||
| 161 | "search" => [ |
||
| 162 | "type" => "search", |
||
| 163 | "label" => "Search:", |
||
| 164 | "description" => "Here you can place a description.", |
||
| 165 | "placeholder" => "Here is a placeholder", |
||
| 166 | ], |
||
| 167 | |||
| 168 | "tel" => [ |
||
| 169 | "type" => "tel", |
||
| 170 | "description" => "Here you can place a description.", |
||
| 171 | "placeholder" => "Here is a placeholder", |
||
| 172 | ], |
||
| 173 | |||
| 174 | "email" => [ |
||
| 175 | "type" => "email", |
||
| 176 | "description" => "Here you can place a description.", |
||
| 177 | "placeholder" => "Here is a placeholder", |
||
| 178 | ], |
||
| 179 | |||
| 180 | "url" => [ |
||
| 181 | "type" => "url", |
||
| 182 | "description" => "Here you can place a description.", |
||
| 183 | "placeholder" => "Here is a placeholder", |
||
| 184 | ], |
||
| 185 | |||
| 186 | "file-multiple" => [ |
||
| 187 | "type" => "file-multiple", |
||
| 188 | "description" => "Here you can place a description.", |
||
| 189 | ], |
||
| 190 | |||
| 191 | "reset" => [ |
||
| 192 | "type" => "reset", |
||
| 193 | ], |
||
| 194 | |||
| 195 | "button" => [ |
||
| 196 | "type" => "button", |
||
| 197 | ], |
||
| 198 | |||
| 199 | "submit" => [ |
||
| 200 | "type" => "submit", |
||
| 201 | "value" => "Submit", |
||
| 202 | "callback" => [$this, "callbackSubmit"] |
||
| 203 | ], |
||
| 256 |