1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CultuurNet\UDB3\Event; |
4
|
|
|
|
5
|
|
|
use CultuurNet\UDB3\Offer\TypeResolverInterface; |
6
|
|
|
use ValueObjects\StringLiteral\StringLiteral; |
7
|
|
|
|
8
|
|
|
class EventTypeResolver implements TypeResolverInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var EventType[] |
12
|
|
|
*/ |
13
|
|
|
private $types; |
14
|
|
|
|
15
|
|
|
public function __construct() |
16
|
|
|
{ |
17
|
|
|
$this->types = [ |
|
|
|
|
18
|
|
|
"0.7.0.0.0" => new EventType("0.7.0.0.0", "Begeleide rondleiding"), |
19
|
|
|
"0.6.0.0.0" => new EventType("0.6.0.0.0", "Beurs"), |
20
|
|
|
"0.50.4.0.0" => new EventType("0.50.4.0.0", "Concert"), |
21
|
|
|
"0.3.1.0.0" => new EventType("0.3.1.0.0", "Cursus of workshop"), |
22
|
|
|
"0.54.0.0.0" => new EventType("0.54.0.0.0", "Dansvoorstelling"), |
23
|
|
|
"1.50.0.0.0" => new EventType("1.50.0.0.0", "Eten en drinken"), |
24
|
|
|
"0.5.0.0.0" => new EventType("0.5.0.0.0", "Festival"), |
25
|
|
|
"0.50.6.0.0" => new EventType("0.50.6.0.0", "Film"), |
26
|
|
|
"0.57.0.0.0" => new EventType("0.57.0.0.0", "Kamp of vakantie"), |
27
|
|
|
"0.28.0.0.0" => new EventType("0.28.0.0.0", "Kermis of feestelijkheid"), |
28
|
|
|
"0.3.2.0.0" => new EventType("0.3.2.0.0", "Lezing of congres"), |
29
|
|
|
"0.37.0.0.0" => new EventType("0.37.0.0.0", "Markt of braderie"), |
30
|
|
|
"0.12.0.0.0" => new EventType("0.12.0.0.0", "Opendeurdag"), |
31
|
|
|
"0.49.0.0.0" => new EventType("0.49.0.0.0", "Party of fuif"), |
32
|
|
|
"0.17.0.0.0" => new EventType("0.17.0.0.0", "Route"), |
33
|
|
|
"0.50.21.0.0" => new EventType("0.50.21.0.0", "Spel of quiz"), |
34
|
|
|
"0.59.0.0.0 " => new EventType("0.59.0.0.0 ", "Sport en beweging"), |
35
|
|
|
"0.19.0.0.0" => new EventType("0.19.0.0.0", "Sportwedstrijd bekijken"), |
36
|
|
|
"0.0.0.0.0" => new EventType("0.0.0.0.0", "Tentoonstelling"), |
37
|
|
|
"0.55.0.0.0" => new EventType("0.55.0.0.0", "Theatervoorstelling"), |
38
|
|
|
]; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
View Code Duplication |
public function byId(StringLiteral $typeId) |
|
|
|
|
42
|
|
|
{ |
43
|
|
|
if (!array_key_exists((string) $typeId, $this->types)) { |
44
|
|
|
throw new \Exception("Unknown event type id: " . $typeId); |
45
|
|
|
} |
46
|
|
|
return $this->types[(string) $typeId]; |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..