|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace EveryPolitician\EveryPoliticianPopolo\Objects; |
|
4
|
|
|
|
|
5
|
|
|
class Organization extends PopoloObject |
|
6
|
|
|
{ |
|
7
|
|
|
protected $properties = [ |
|
8
|
|
|
'id', |
|
9
|
|
|
'name', |
|
10
|
|
|
'wikidata', |
|
11
|
|
|
'classification', |
|
12
|
|
|
'image', |
|
13
|
|
|
'foundingDate', |
|
14
|
|
|
'dissolutionDate', |
|
15
|
|
|
'seats', |
|
16
|
|
|
'otherNames', |
|
17
|
|
|
'identifiers', |
|
18
|
|
|
'links', |
|
19
|
|
|
]; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* String representation of {@link Organization} |
|
23
|
|
|
* |
|
24
|
|
|
* @return string |
|
25
|
|
|
*/ |
|
26
|
3 |
|
public function __toString() |
|
27
|
|
|
{ |
|
28
|
3 |
|
return "<Organization: ".$this->name.">"; |
|
|
|
|
|
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
48 |
|
protected function getId() |
|
32
|
|
|
{ |
|
33
|
48 |
|
return $this->arrGet($this->data, 'id'); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
6 |
|
protected function getName() |
|
37
|
|
|
{ |
|
38
|
6 |
|
return $this->arrGet($this->data, 'name'); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
6 |
|
protected function getWikidata() |
|
42
|
|
|
{ |
|
43
|
6 |
|
return $this->identifierValue('wikidata'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
3 |
|
protected function getClassification() |
|
47
|
|
|
{ |
|
48
|
3 |
|
return $this->arrGet($this->data, 'classification'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
3 |
|
protected function getImage() |
|
52
|
|
|
{ |
|
53
|
3 |
|
return $this->arrGet($this->data, 'image'); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
3 |
|
protected function getFoundingDate() |
|
57
|
|
|
{ |
|
58
|
3 |
|
return $this->getDate('founding_date'); |
|
59
|
|
|
} |
|
60
|
3 |
|
protected function getDissolutionDate() |
|
61
|
|
|
{ |
|
62
|
3 |
|
return $this->getDate('dissolution_date'); |
|
63
|
|
|
} |
|
64
|
3 |
|
protected function getSeats() |
|
65
|
|
|
{ |
|
66
|
3 |
|
return $this->arrGet($this->data, 'seats'); |
|
67
|
|
|
} |
|
68
|
3 |
|
protected function getOtherNames() |
|
69
|
|
|
{ |
|
70
|
3 |
|
return $this->arrGet($this->data, 'other_names', []); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
3 |
|
protected function getIdentifiers() |
|
74
|
|
|
{ |
|
75
|
3 |
|
return $this->getRelatedObjectArr('identifiers'); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
3 |
|
protected function getLinks() |
|
79
|
|
|
{ |
|
80
|
3 |
|
return $this->getRelatedObjectArr('links'); |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.