Completed
Push — master ( 8e9b2d...71f485 )
by Quentin
17:01 queued 12:32
created

RemoveComponentCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
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($component);
0 ignored issues
show
Bug introduced by
The variable $component does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
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