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

AbstractLabelCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 51
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabel() 0 4 1
A getItemId() 0 4 1
A getPermission() 0 4 1
A getName() 0 4 1
A __construct() 0 7 1
1
<?php
2
3
namespace CultuurNet\UDB3\Organizer\Commands;
4
5
use CultuurNet\UDB3\Label;
6
use CultuurNet\UDB3\Offer\Commands\AuthorizableCommandInterface;
7
use CultuurNet\UDB3\Role\ValueObjects\Permission;
8
use CultuurNet\UDB3\Security\LabelSecurityInterface;
9
use ValueObjects\String\String as StringLiteral;
10
11
abstract class AbstractLabelCommand extends AbstractOrganizerCommand implements AuthorizableCommandInterface, LabelSecurityInterface
12
{
13
    /**
14
     * @var Label
15
     */
16
    private $label;
17
18
    /**
19
     * @param string $organizerId
20
     * @param Label $label
21
     */
22
    public function __construct(
23
        $organizerId,
24
        Label $label
25
    ) {
26
        parent::__construct($organizerId);
27
        $this->label = $label;
28
    }
29
30
    /**
31
     * @return Label
32
     */
33
    public function getLabel()
34
    {
35
        return $this->label;
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function getItemId()
42
    {
43
        return $this->getOrganizerId();
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function getPermission()
50
    {
51
        return Permission::AANBOD_BEWERKEN();
52
    }
53
54
    /**
55
     * @inheritdoc
56
     */
57
    public function getName()
58
    {
59
        return new StringLiteral((string) $this->label);
60
    }
61
}
62