1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace luya\web\jsonld; |
4
|
|
|
|
5
|
|
|
use luya\helpers\ObjectHelper; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* JsonLd ContactPoint. |
10
|
|
|
* |
11
|
|
|
* @see http://schema.org/ContactPoint |
12
|
|
|
* @author Basil Suter <[email protected]> |
13
|
|
|
* @since 1.0.3 |
14
|
|
|
*/ |
15
|
|
|
class ContactPoint extends BaseThing |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @inheritdoc |
19
|
|
|
*/ |
20
|
|
|
public function typeDefintion() |
21
|
|
|
{ |
22
|
|
|
return 'ContactPoint'; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
private $_email; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Setter method for email. |
29
|
|
|
* |
30
|
|
|
* @param string $email |
31
|
|
|
* @return static |
32
|
|
|
*/ |
33
|
|
|
public function setEmail($email) |
34
|
|
|
{ |
35
|
|
|
$this->_email = $email; |
36
|
|
|
return $this; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Getter method for email. |
41
|
|
|
* |
42
|
|
|
* @return string |
43
|
|
|
*/ |
44
|
|
|
public function getEmail() |
45
|
|
|
{ |
46
|
|
|
return $this->_email; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
private $_telephone; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Setter method for telephone. |
53
|
|
|
* |
54
|
|
|
* @param string $telephone |
55
|
|
|
* @return static |
56
|
|
|
*/ |
57
|
|
|
public function setTelephone($telephone) |
58
|
|
|
{ |
59
|
|
|
$this->_telephone = $telephone; |
60
|
|
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Getter method for telephone. |
65
|
|
|
* |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getTelephone() |
69
|
|
|
{ |
70
|
|
|
return $this->_telephone; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
private $_areaServed; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Set Area Served. |
77
|
|
|
* |
78
|
|
|
* The geographic area where a service or offered item is provided. Supersedes serviceArea. |
79
|
|
|
* |
80
|
|
|
* @param Place|TextValue $areaServed |
81
|
|
|
* @return static |
82
|
|
|
*/ |
83
|
|
|
public function setAreaServed($areaServed) |
84
|
|
|
{ |
85
|
|
|
ObjectHelper::isInstanceOf($areaServed, [Place::class, TextValue::class]); |
|
|
|
|
86
|
|
|
|
87
|
|
|
$this->_areaServed = $areaServed; |
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get Area Served. |
93
|
|
|
* |
94
|
|
|
* @return Place|TextValue |
95
|
|
|
*/ |
96
|
|
|
public function getAreaServed() |
97
|
|
|
{ |
98
|
|
|
return $this->_areaServed; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
private $_availableLanguage; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Set Available Language. |
105
|
|
|
* |
106
|
|
|
* A language someone may use with or at the item, service or place. Please use one of the language codes from the IETF BCP 47 standard. See also inLanguage |
107
|
|
|
* |
108
|
|
|
* @param string $availableLanguage |
109
|
|
|
* @return static |
110
|
|
|
*/ |
111
|
|
|
public function setAvailableLanguage($availableLanguage) |
112
|
|
|
{ |
113
|
|
|
$this->_availableLanguage = $availableLanguage; |
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Get Available Language. |
119
|
|
|
* |
120
|
|
|
* @return string |
121
|
|
|
*/ |
122
|
|
|
public function getAvailableLanguage() |
123
|
|
|
{ |
124
|
|
|
return $this->_availableLanguage; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
private $_contactType; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Set Contact Type. |
131
|
|
|
* |
132
|
|
|
* A person or organization can have different contact points, for different purposes. For example, a sales contact point, a PR contact point and so on. This property is used to specify the kind of contact point. |
133
|
|
|
* |
134
|
|
|
* @param string $contactType |
135
|
|
|
* @return static |
136
|
|
|
*/ |
137
|
|
|
public function setContactType($contactType) |
138
|
|
|
{ |
139
|
|
|
$this->_contactType = $contactType; |
140
|
|
|
return $this; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Get Contact Type |
145
|
|
|
* |
146
|
|
|
* @return string |
147
|
|
|
*/ |
148
|
|
|
public function getContactType() |
149
|
|
|
{ |
150
|
|
|
return $this->_contactType; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
private $_faxNumber; |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Set Fax Number. |
157
|
|
|
* |
158
|
|
|
* The fax number. |
159
|
|
|
* |
160
|
|
|
* @param string $faxNumber |
161
|
|
|
* @return static |
162
|
|
|
*/ |
163
|
|
|
public function setFaxNumber($faxNumber) |
164
|
|
|
{ |
165
|
|
|
$this->_faxNumber = $faxNumber; |
166
|
|
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* Get Fax Number. |
171
|
|
|
* |
172
|
|
|
* @return string. |
|
|
|
|
173
|
|
|
*/ |
174
|
|
|
public function getFaxNumber() |
175
|
|
|
{ |
176
|
|
|
return $this->_faxNumber; |
177
|
|
|
} |
178
|
|
|
} |
179
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: