Completed
Pull Request — master (#90)
by Arnaud
03:09
created

Action   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 27.27%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 68
ccs 3
cts 11
cp 0.2727
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfiguration() 0 4 1
A getConfiguration() 0 4 1
A isLoadingRequired() 0 7 1
A getName() 0 4 1
1
<?php
2
3
namespace LAG\AdminBundle\Action;
4
5
use LAG\AdminBundle\Action\Configuration\ActionConfiguration;
6
use LAG\AdminBundle\Admin\Admin;
7
use LAG\AdminBundle\Admin\Behaviors\AdminAwareTrait;
8
use Symfony\Component\Form\FormFactoryInterface;
9
10
abstract class Action implements ActionInterface
11
{
12
    use AdminAwareTrait;
13
    
14
    /**
15
     * Action name.
16
     *
17
     * @var string
18
     */
19
    protected $name;
20
    
21
    /**
22
     * Action configuration (it has been resolved so it should be valid).
23
     *
24
     * @var ActionConfiguration
25
     */
26
    protected $configuration;
27
    
28
    /**
29
     * Form factory.
30
     *
31
     * @var FormFactoryInterface
32
     */
33
    protected $formFactory;
34
    
35
    /**
36
     * @inheritdoc
37
     *
38
     * @param ActionConfiguration $configuration
39
     */
40 4
    public function setConfiguration(ActionConfiguration $configuration)
41
    {
42 4
        $this->configuration = $configuration;
43 4
    }
44
    
45
    /**
46
     * @inheritdoc
47
     *
48
     * @return ActionConfiguration
49
     */
50
    public function getConfiguration()
51
    {
52
        return $this->configuration;
53
    }
54
    
55
    /**
56
     * @inheritdoc
57
     *
58
     * @return bool
59
     */
60
    public function isLoadingRequired()
61
    {
62
        return Admin::LOAD_STRATEGY_NONE !== $this
63
            ->configuration
64
            ->getParameter('load_method')
65
        ;
66
    }
67
    
68
    /**
69
     * @inheritdoc
70
     *
71
     * @return string
72
     */
73
    public function getName()
74
    {
75
        return $this->name;
76
    }
77
}
78