|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace CultuurNet\UDB3\Event; |
|
4
|
|
|
|
|
5
|
|
|
use CultuurNet\UDB3\Facility; |
|
6
|
|
|
use CultuurNet\UDB3\Offer\OfferFacilityResolver; |
|
7
|
|
|
|
|
8
|
|
|
class EventFacilityResolver extends OfferFacilityResolver |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @inheritdoc |
|
12
|
|
|
*/ |
|
13
|
|
|
final protected function getFacilities() |
|
14
|
|
|
{ |
|
15
|
|
|
return [ |
|
|
|
|
|
|
16
|
|
|
"3.23.2.0.0" => new Facility("3.23.2.0.0", "Assistentie"), |
|
17
|
|
|
"3.13.1.0.0" => new Facility("3.13.1.0.0", "Voorzieningen voor assistentiehonden"), |
|
18
|
|
|
"3.13.2.0.0" => new Facility("3.13.2.0.0", "Audiodescriptie"), |
|
19
|
|
|
"3.17.1.0.0" => new Facility("3.17.1.0.0", "Ringleiding"), |
|
20
|
|
|
"3.17.2.0.0" => new Facility("3.17.2.0.0", "Voelstoelen"), |
|
21
|
|
|
"3.17.3.0.0" => new Facility("3.17.3.0.0", "Boven- of ondertiteling"), |
|
22
|
|
|
"3.26.0.0.0" => new Facility("3.26.0.0.0", "Parkeerplaats"), |
|
23
|
|
|
"3.27.0.0.0" => new Facility("3.27.0.0.0", "Rolstoeltoegankelijk"), |
|
24
|
|
|
"3.28.0.0.0" => new Facility("3.28.0.0.0", "Alternatieve ingang"), |
|
25
|
|
|
"3.29.0.0.0" => new Facility("3.29.0.0.0", "Gegarandeerd zicht"), |
|
26
|
|
|
"3.30.0.0.0" => new Facility("3.30.0.0.0", "Rolstoelpodium"), |
|
27
|
|
|
"3.32.0.0.0" => new Facility("3.32.0.0.0", "Voorbehouden camping"), |
|
28
|
|
|
"3.31.0.0.0" => new Facility("3.31.0.0.0", "Toegankelijk sanitair"), |
|
29
|
|
|
"3.33.0.0.0" => new Facility("3.33.0.0.0", "Tolken Vlaamse Gebarentaal"), |
|
30
|
|
|
"3.34.0.0.0" => new Facility("3.34.0.0.0", "Vereenvoudigde informatie"), |
|
31
|
|
|
"3.35.0.0.0" => new Facility("3.35.0.0.0", "1 begeleider gratis"), |
|
32
|
|
|
"3.36.0.0.0" => new Facility("3.36.0.0.0", "Verzorgingsruimte"), |
|
33
|
|
|
"3.37.0.0.0" => new Facility("3.37.0.0.0", "Oplaadzone rolstoelen"), |
|
34
|
|
|
"3.38.0.0.0" => new Facility("3.38.0.0.0", "Inter-assistentie"), |
|
35
|
|
|
"3.39.0.0.0" => new Facility("3.39.0.0.0", "Begeleiderspas"), |
|
36
|
|
|
"3.40.0.0.0" => new Facility("3.40.0.0.0", "Inter-events"), |
|
37
|
|
|
]; |
|
38
|
|
|
} |
|
39
|
|
|
} |
|
40
|
|
|
|
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.
Let’s take a look at an example:
Our function
my_functionexpects aPostobject, and outputs the author of the post. The base classPostreturns a simple string and outputting a simple string will work just fine. However, the child classBlogPostwhich is a sub-type ofPostinstead decided to return anobject, and is therefore violating the SOLID principles. If aBlogPostwere passed tomy_function, PHP would not complain, but ultimately fail when executing thestrtouppercall in its body.