ResourceType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 38
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 8 1
A configureOptions() 0 7 1
A getBlockPrefix() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of Webcook security bundle.
5
 *
6
 * See LICENSE file in the root of the bundle. Webcook 
7
 */
8
9
namespace Webcook\Cms\SecurityBundle\Form\Type;
10
11
use Symfony\Component\Form\AbstractType;
12
use Symfony\Component\Form\FormBuilderInterface;
13
use Symfony\Component\OptionsResolver\OptionsResolver;
14
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
15
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
16
17
/**
18
 * Form type of resource.
19
 */
20
class ResourceType extends AbstractType
21
{
22
    /**
23
     * {@inheritdoc}
24
     *
25
     * @param FormBuilderInterface $builder
26
     * @param array                $options
27
     */
28 1
    public function buildForm(FormBuilderInterface $builder, array $options)
29
    {
30
        $builder
31 1
            ->add('view', CheckboxType::class)
32 1
            ->add('edit', CheckboxType::class)
33 1
            ->add('delete', CheckboxType::class)
34 1
            ->add('id', IntegerType::class);
35 1
    }
36
37
    /**
38
     * {@inheritdoc}
39
     *
40
     * @param OptionsResolver $resolver
41
     */
42 1
    public function configureOptions(OptionsResolver $resolver)
43
    {
44 1
        $resolver->setDefaults(array(
45 1
            'data_class' => \Webcook\Cms\SecurityBundle\Entity\RoleResource::class,
46
            'csrf_protection'   => false,
47
        ));
48 1
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53 1
    public function getBlockPrefix()
54
    {
55 1
        return 'resource';
56
    }
57
}
58