Completed
Push — master ( b453a3...b1e9d6 )
by Ruud
40:05 queued 27:14
created

RawHTMLPagePartAdminType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 36
loc 36
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBlockPrefix() 4 4 1
A configureOptions() 6 6 1
A buildForm() 11 11 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 Kunstmaan\PagePartBundle\Form;
4
5
use Symfony\Component\Form\AbstractType;
6
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10
/**
11
 * class to add content to a raw html pagepart
12
 */
13 View Code Duplication
class RawHTMLPagePartAdminType extends AbstractType
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * @param \Symfony\Component\Form\FormBuilderInterface $builder
17
     * @param array                                        $options
18
     */
19 1
    public function buildForm(FormBuilderInterface $builder, array $options)
20
    {
21 1
        $builder->add('content', TextareaType::class, array(
22 1
            'label' => 'pagepart.html.content',
23
            'required' => false,
24
            'attr' => array(
25
                'style' => 'width: 600px',
26
                'rows' => 32,
27
            ),
28
        ));
29 1
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getBlockPrefix()
35
    {
36
        return 'kunstmaan_pagepartbundle_rawhtmlpageparttype';
37
    }
38
39
    /**
40
     * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
41
     */
42 1
    public function configureOptions(OptionsResolver $resolver)
43
    {
44 1
        $resolver->setDefaults(array(
45 1
            'data_class' => 'Kunstmaan\PagePartBundle\Entity\RawHTMLPagePart',
46
        ));
47 1
    }
48
}
49