| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| Code Lines | 46 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | 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 |
||
| 198 | protected function configureFormFields(FormMapper $formMapper) |
||
| 199 | { |
||
| 200 | $formMapper |
||
| 201 | ->tab('fp.label.admin.publication.tab_main') |
||
| 202 | ->with('') |
||
| 203 | ->add('Title', null, array( |
||
| 204 | 'label' => 'fp.label.admin.publication.title', |
||
| 205 | 'constraints' => array( |
||
| 206 | new Length(array( |
||
| 207 | 'max' => 255, |
||
| 208 | 'minMessage' => 'fp.constraint.longer_than_255' |
||
| 209 | )) |
||
| 210 | ) |
||
| 211 | )) |
||
| 212 | ->add('Content', $this->content_editor, array( |
||
| 213 | 'label' => 'fp.label.admin.publication.content' |
||
| 214 | )) |
||
| 215 | ->add('IsPublished', null, array( |
||
| 216 | 'label' => 'fp.label.admin.publication.is_published', |
||
| 217 | 'required' => false |
||
| 218 | )) |
||
| 219 | ->end() |
||
| 220 | ->end() |
||
| 221 | |||
| 222 | ->tab('fp.label.admin.publication.tab_image') |
||
| 223 | ->with('') |
||
| 224 | ->add('CroppableImage', 'croppable', array( |
||
| 225 | 'translation_domain' => $this->getTranslationDomain(), |
||
| 226 | 'label' => 'fp.label.admin.publication.image', |
||
| 227 | 'width' => 140, |
||
| 228 | 'height' => 95 |
||
| 229 | )) |
||
| 230 | ->end() |
||
| 231 | ->end() |
||
| 232 | |||
| 233 | ->tab('fp.label.admin.publication.tab_additional') |
||
| 234 | ->with('') |
||
| 235 | ->add('Slug', null, array( |
||
| 236 | 'label' => 'fp.label.admin.publication.slug', |
||
| 237 | 'constraints' => array( |
||
| 238 | new Regex(array( |
||
| 239 | 'pattern' => '/^[\w\-]+$/', |
||
| 240 | 'message' => 'fp.constraint.not_alphanumeric' |
||
| 241 | )) |
||
| 242 | ) |
||
| 243 | )) |
||
| 244 | ->add('Announcement', null, array( |
||
| 245 | 'label' => 'fp.label.admin.publication.announcement' |
||
| 246 | )) |
||
| 247 | ->add('CreatedAt', 'datetime_no_intl_picker', array( |
||
| 248 | 'label' => 'fp.label.admin.publication.created_at', |
||
| 249 | 'format' => $this->datetime_format, |
||
| 250 | 'required' => false |
||
| 251 | )) |
||
| 252 | ->end() |
||
| 253 | ->end() |
||
| 254 | |||
| 255 | ->setHelps(array( |
||
| 256 | 'Slug' => 'fp.label.admin.hint.slug', |
||
| 257 | 'Announcement' => 'fp.label.admin.hint.announcement', |
||
| 258 | 'CreatedAt' => 'fp.label.admin.hint.created_at' |
||
| 259 | )) |
||
| 260 | ; |
||
| 261 | } |
||
| 262 | |||
| 274 |