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

Action::isLoadingRequired()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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