Completed
Push — master ( 5ace45...cd9bd4 )
by
unknown
14s queued 10s
created

AbstractLabelCommand   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabel() 0 4 1
A getItemId() 0 4 1
A __construct() 0 7 1
A getNames() 0 6 1
A getPermission() 0 4 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\StringLiteral\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 getNames()
50
    {
51
        return [
52
            new StringLiteral((string) $this->label),
53
        ];
54
    }
55
56
    public function getPermission()
57
    {
58
        return Permission::AANBOD_BEWERKEN();
59
    }
60
}
61