RemoveComponentCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 50
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A resolve() 0 10 1
A setComponent() 0 6 1
1
<?php
2
3
namespace Synapse\Cmf\Framework\Theme\Zone\Domain\Command;
4
5
use Synapse\Cmf\Framework\Theme\Component\Domain\DomainInterface as ComponentDomain;
6
use Synapse\Cmf\Framework\Theme\Component\Model\ComponentInterface;
7
8
/**
9
 * Zone component removal command representation.
10
 */
11
class RemoveComponentCommand extends UpdateCommand
12
{
13
    /**
14
     * @var ComponentDomain
15
     */
16
    protected $componentDomain;
17
18
    /**
19
     * @var ComponentInterface
20
     */
21
    protected $component;
22
23
    /**
24
     * Construct.
25
     *
26
     * @param ComponentDomain $componentDomain
27
     */
28
    public function __construct(ComponentDomain $componentDomain)
29
    {
30
        $this->componentDomain = $componentDomain;
31
    }
32
33
    /**
34
     * @see ActionInterface::resolve()
35
     */
36
    public function resolve()
37
    {
38
        $this->components->remove(
39
            $this->component->getId()
40
        );
41
42
        $this->componentDomain->delete($this->component);
43
44
        return parent::resolve();
45
    }
46
47
    /**
48
     * Define component to delete.
49
     *
50
     * @param ComponentInterface $component
51
     *
52
     * @return self
53
     */
54
    public function setComponent(ComponentInterface $component)
55
    {
56
        $this->component = $component;
57
58
        return $this;
59
    }
60
}
61