Completed
Push — master ( 5af20f...a965fa )
by Jonas
17s queued 10s
created

LocationId   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A isDummyPlaceForEducation() 0 4 1
A setDummyPlaceForEducationIds() 0 4 1
1
<?php
2
3
namespace CultuurNet\UDB3\Event\ValueObjects;
4
5
use ValueObjects\StringLiteral\StringLiteral;
6
7
class LocationId extends StringLiteral
8
{
9
    private static $dummyPlaceForEducationIds = [];
10
11
    public function __construct($value)
12
    {
13
        parent::__construct($value);
14
15
        if (empty($value)) {
16
            throw new \InvalidArgumentException('LocationId can\'t have an empty value.');
17
        }
18
    }
19
20
    public function isDummyPlaceForEducation(): bool
21
    {
22
        return in_array($this->value, self::$dummyPlaceForEducationIds);
23
    }
24
25
    public static function setDummyPlaceForEducationIds(array $dummyPlaceForEducationIds): void
26
    {
27
        self::$dummyPlaceForEducationIds = $dummyPlaceForEducationIds;
28
    }
29
}
30