Completed
Push — master ( 4e3396...61149e )
by Piotr
12s
created

GenericResourceElement   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 61
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getRoute() 0 4 1
A getRouteParameters() 0 6 1
A getSuccessRoute() 0 4 1
A getSuccessRouteParameters() 0 4 1
getKey() 0 1 ?
A getResourceFormOptions() 0 4 1
A configureOptions() 0 8 1
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\Bundle\AdminBundle\Admin\ResourceRepository;
11
12
use FSi\Bundle\AdminBundle\Admin\AbstractElement;
13
use Symfony\Component\OptionsResolver\OptionsResolver;
14
15
abstract class GenericResourceElement extends AbstractElement implements Element
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function getRoute()
21
    {
22
        return 'fsi_admin_resource';
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getRouteParameters()
29
    {
30
        return [
31
            'element' => $this->getId(),
32
        ];
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getSuccessRoute()
39
    {
40
        return $this->getRoute();
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function getSuccessRouteParameters()
47
    {
48
        return $this->getRouteParameters();
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    abstract public function getKey();
55
56
    /**
57
     * @return array
58
     */
59
    public function getResourceFormOptions()
60
    {
61
        return [];
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function configureOptions(OptionsResolver $resolver)
68
    {
69
        $resolver->setDefaults([
70
            'template' => null,
71
        ]);
72
73
        $resolver->setAllowedTypes('template', ['null', 'string']);
74
    }
75
}
76