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

AbstractImportLabels::getNames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
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