Completed
Pull Request — master (#239)
by Luc
05:02
created

AbstractLabelCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 45
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getItemId() 0 4 1
A getLabel() 0 4 1
A getName() 0 4 1
1
<?php
2
3
namespace CultuurNet\UDB3\Offer\Commands;
4
5
use CultuurNet\UDB3\Label;
6
use CultuurNet\UDB3\Security\LabelSecurityInterface;
7
use ValueObjects\String\String as StringLiteral;
8
9
abstract class AbstractLabelCommand extends AbstractCommand implements LabelSecurityInterface
10
{
11
    /**
12
     * @var Label
13
     */
14
    protected $label;
15
16
    /**
17
     * @param $itemId
18
     *  The id of the item that is targeted by the command.
19
     *
20
     * @param Label $label
21
     *  The label that is used in the command.
22
     */
23
    public function __construct($itemId, Label $label)
24
    {
25
        parent::__construct($itemId);
26
        $this->label = $label;
27
        $this->itemId = $itemId;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getItemId()
34
    {
35
        return $this->itemId;
36
    }
37
38
    /**
39
     * @return Label
40
     */
41
    public function getLabel()
42
    {
43
        return $this->label;
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function getName()
50
    {
51
        return new StringLiteral((string)$this->label);
52
    }
53
}
54