Completed
Pull Request — master (#349)
by Luc
06:21
created

AbstractImportLabels::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace CultuurNet\UDB3\Offer\Commands;
4
5
use CultuurNet\UDB3\Model\ValueObject\Taxonomy\Label\Label;
6
use CultuurNet\UDB3\Model\ValueObject\Taxonomy\Label\Labels;
7
use CultuurNet\UDB3\Security\LabelSecurityInterface;
8
use ValueObjects\StringLiteral\StringLiteral;
9
10
abstract class AbstractImportLabels extends AbstractCommand implements LabelSecurityInterface
11
{
12
    /**
13
     * @var Labels
14
     */
15
    private $labels;
16
17
    /**
18
     * @param string $itemId
19
     * @param Labels $labels
20
     */
21
    public function __construct($itemId, Labels $labels)
22
    {
23
        parent::__construct($itemId);
24
        $this->labels = $labels;
25
    }
26
27
    /**
28
     * @return Labels
29
     */
30
    public function getLabels()
31
    {
32
        return $this->labels;
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function getNames()
39
    {
40
        return array_map(
41
            function (Label $label) {
42
                return new StringLiteral($label->getName()->toString());
43
            },
44
            $this->getLabels()->toArray()
45
        );
46
    }
47
}
48