| Conditions | 7 | 
| Paths | 1 | 
| Total Lines | 64 | 
| Code Lines | 45 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 1 | 
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  | 
            ||
| 21 | protected function configureFormFields(FormMapper $formMapper)  | 
            ||
| 22 |     { | 
            ||
| 23 |         $performanceEventId = $this->getRequest()->query->get('performanceEvent_id'); | 
            ||
| 24 | $formMapper  | 
            ||
| 25 |             ->add('venueSector', null, [ | 
            ||
| 26 | 'required' => true,  | 
            ||
| 27 |                 'query_builder' => function (EntityRepository $rep) use ($performanceEventId) { | 
            ||
| 28 |                     $qb = $rep->createQueryBuilder('p'); | 
            ||
| 29 |                     if ($performanceEventId) { | 
            ||
| 30 | $performanceEvent = $this->getConfigurationPool()  | 
            ||
| 31 |                             ->getContainer()->get('doctrine.orm.default_entity_manager') | 
            ||
| 32 |                             ->getRepository('AppBundle\Entity\PerformanceEvent') | 
            ||
| 33 | ->find($performanceEventId);  | 
            ||
| 34 | $venueSectors = $performanceEvent->getVenue()->getVenueSector();  | 
            ||
| 35 |                         foreach ($venueSectors as $sector) { | 
            ||
| 36 |                             $qb->orWhere("p.id = ".$sector->getId()); | 
            ||
| 37 | }  | 
            ||
| 38 | }  | 
            ||
| 39 |                     if (($this->getSubject() !== null) && ($performanceEventId === null)) { | 
            ||
| 40 | $performanceEvent = $this->getSubject()->getPerformanceEvent();  | 
            ||
| 41 | $venueSectors = $performanceEvent->getVenue()->getVenueSector();  | 
            ||
| 42 |                         foreach ($venueSectors as $sector) { | 
            ||
| 43 |                             $qb->orWhere("p.id = ".$sector->getId()); | 
            ||
| 44 | }  | 
            ||
| 45 | }  | 
            ||
| 46 | return $qb;  | 
            ||
| 47 | }  | 
            ||
| 48 | ])  | 
            ||
| 49 |             ->add('color', 'sonata_type_color_selector', [ | 
            ||
| 50 | 'label' => 'Color'  | 
            ||
| 51 | ])  | 
            ||
| 52 |             ->add('rows', TextType::class, [ | 
            ||
| 53 | 'required' => true,  | 
            ||
| 54 | 'attr' => [  | 
            ||
| 55 | 'placeholder' => '1-5,6,7,10-15',  | 
            ||
| 56 | ]  | 
            ||
| 57 | ])  | 
            ||
| 58 |             ->add('places', TextType::class, [ | 
            ||
| 59 | 'required' => true,  | 
            ||
| 60 | 'attr' => [  | 
            ||
| 61 | 'placeholder' => '1-5,6,7,10-15',  | 
            ||
| 62 | ]  | 
            ||
| 63 | ])  | 
            ||
| 64 |             ->add('price', IntegerType::class, [ | 
            ||
| 65 | 'required' => true,  | 
            ||
| 66 | 'attr' => [  | 
            ||
| 67 | 'placeholder' => '50',  | 
            ||
| 68 | ]  | 
            ||
| 69 | ])  | 
            ||
| 70 |             ->add('performanceEvent', null, [ | 
            ||
| 71 | 'required' => true,  | 
            ||
| 72 | 'attr' => ['class' => 'hidden'],  | 
            ||
| 73 | 'label' => false,  | 
            ||
| 74 |                 'query_builder' => function (EntityRepository $rep) use ($performanceEventId) { | 
            ||
| 75 |                     $qb = $rep->createQueryBuilder('p'); | 
            ||
| 76 |                     if ($performanceEventId) { | 
            ||
| 77 |                         $qb ->where('p.id = :performanceEvent_id') | 
            ||
| 78 |                             ->setParameter('performanceEvent_id', $performanceEventId); | 
            ||
| 79 | }  | 
            ||
| 80 | return $qb;  | 
            ||
| 81 | }  | 
            ||
| 82 | ])  | 
            ||
| 83 | ;  | 
            ||
| 84 | }  | 
            ||
| 85 | }  | 
            ||
| 86 |