ResourceType::configureOptions()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 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