SerieType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 31
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 15 15 1
A configureOptions() 7 7 1
A getBlockPrefix() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace KI\PonthubBundle\Form;
4
5
use KI\CoreBundle\Selector\ImageSelector;
6
use KI\CoreBundle\Selector\TagsSelector;
7
use KI\PonthubBundle\Entity\Serie;
8
use KI\PonthubBundle\Selector\ActorsSelector;
9
use KI\PonthubBundle\Selector\GenresSelector;
10
use Symfony\Component\Form\AbstractType;
11
use Symfony\Component\Form\FormBuilderInterface;
12
use Symfony\Component\OptionsResolver\OptionsResolver;
13
14 View Code Duplication
class SerieType extends AbstractType
15
{
16
    public function buildForm(FormBuilderInterface $builder, array $options)
17
    {
18
        $builder
19
            ->add('name')
20
            ->add('description')
21
            ->add('actors', ActorsSelector::class)
22
            ->add('genres', GenresSelector::class)
23
            ->add('tags', TagsSelector::class)
24
            ->add('duration')
25
            ->add('director')
26
            ->add('rating')
27
            ->add('year')
28
            ->add('image', ImageSelector::class)
29
        ;
30
    }
31
32
    public function configureOptions(OptionsResolver $resolver)
33
    {
34
        $resolver->setDefaults([
35
            'csrf_protection' => false,
36
            'data_class' => Serie::class
37
        ]);
38
    }
39
40
    public function getBlockPrefix()
41
    {
42
        return '';
43
    }
44
}
45