| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 54 | 
| 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  | 
            ||
| 100 | protected function configureFormFields(FormMapper $formMapper)  | 
            ||
| 101 |     { | 
            ||
| 102 | $formMapper  | 
            ||
| 103 |             ->with('form.group_general') | 
            ||
| 104 |             ->add('name', TextType::class) | 
            ||
| 105 |             ->add('title', TextType::class) | 
            ||
| 106 | ->add(  | 
            ||
| 107 | 'children',  | 
            ||
| 108 | CollectionType::class,  | 
            ||
| 109 | ['label' => false, 'type_options' => [  | 
            ||
| 110 | 'delete' => true,  | 
            ||
| 111 | 'delete_options' => [  | 
            ||
| 112 | 'type' => CheckboxType::class,  | 
            ||
| 113 | 'type_options' => ['required' => false, 'mapped' => false],  | 
            ||
| 114 | ], ],  | 
            ||
| 115 | ],  | 
            ||
| 116 | ['edit' => 'inline', 'inline' => 'table', 'admin_code' => 'sonata_admin_doctrine_phpcr.test.admin']  | 
            ||
| 117 | )  | 
            ||
| 118 | ->add(  | 
            ||
| 119 | 'routes',  | 
            ||
| 120 | ModelType::class,  | 
            ||
| 121 | ['property' => 'title', 'multiple' => true, 'expanded' => false]  | 
            ||
| 122 | )  | 
            ||
| 123 |             ->add('parentDocument', | 
            ||
| 124 | TreeSelectType::class, [  | 
            ||
| 125 | 'widget' => 'browser',  | 
            ||
| 126 | 'root_node' => $this->getRootPath(),  | 
            ||
| 127 | ])  | 
            ||
| 128 | ->add(  | 
            ||
| 129 | 'child',  | 
            ||
| 130 | ModelType::class,  | 
            ||
| 131 | [  | 
            ||
| 132 | 'property' => 'title',  | 
            ||
| 133 | 'class' => Content::class,  | 
            ||
| 134 | 'btn_catalogue' => 'List',  | 
            ||
| 135 | 'required' => false,  | 
            ||
| 136 | ],  | 
            ||
| 137 | ['admin_code' => 'sonata_admin_doctrine_phpcr.test.admin']  | 
            ||
| 138 | )  | 
            ||
| 139 |             ->add('singleRoute', | 
            ||
| 140 | TreeSelectType::class, [  | 
            ||
| 141 | 'widget' => 'browser',  | 
            ||
| 142 | 'root_node' => $this->getRootPath(),  | 
            ||
| 143 | ])  | 
            ||
| 144 | ->end();  | 
            ||
| 145 | |||
| 146 |         $formMapper->getFormBuilder()->get('parentDocument')->addModelTransformer(new DocumentToPathTransformer( | 
            ||
| 147 | $this->managerRegistry->getManagerForClass($this->getClass())  | 
            ||
| 148 | ));  | 
            ||
| 149 | |||
| 150 |         $formMapper->getFormBuilder()->get('singleRoute')->addModelTransformer(new DocumentToPathTransformer( | 
            ||
| 151 | $this->managerRegistry->getManagerForClass($this->getClass())  | 
            ||
| 152 | ));  | 
            ||
| 153 | }  | 
            ||
| 154 | |||
| 162 |