|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace rhertogh\Yii2Oauth2Server\components\openidconnect\claims; |
|
4
|
|
|
|
|
5
|
|
|
use rhertogh\Yii2Oauth2Server\interfaces\components\openidconnect\claims\Oauth2OidcAddressClaimInterface; |
|
6
|
|
|
use yii\base\BaseObject; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @see https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim |
|
10
|
|
|
* |
|
11
|
|
|
* @property string $formatted Full mailing address, formatted for display or use on a mailing label. |
|
12
|
|
|
* This field MAY contain multiple lines, separated by newlines. Newlines can be represented either as a carriage |
|
13
|
|
|
* return/line feed pair ("\r\n") or as a single line feed character ("\n"). |
|
14
|
|
|
* |
|
15
|
|
|
* @property string $streetAddress Full street address component, which MAY include house number, street name, |
|
16
|
|
|
* Post Office Box, and multi-line extended street address information. This field MAY contain multiple lines, |
|
17
|
|
|
* separated by newlines. Newlines can be represented either as a carriage return/line feed pair ("\r\n") or |
|
18
|
|
|
* as a single line feed character ("\n"). |
|
19
|
|
|
* |
|
20
|
|
|
* @property string $locality City or locality component. |
|
21
|
|
|
* |
|
22
|
|
|
* @property string $region State, province, prefecture, or region component. |
|
23
|
|
|
* |
|
24
|
|
|
* @property string $postalCode Zip code or postal code component. |
|
25
|
|
|
* |
|
26
|
|
|
* @property string $country Country name component. |
|
27
|
|
|
*/ |
|
28
|
|
|
class Oauth2OidcAddressClaim extends BaseObject implements Oauth2OidcAddressClaimInterface, \JsonSerializable |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* @var string |
|
32
|
|
|
*/ |
|
33
|
|
|
protected $_formatted; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $_street_address; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var string |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $_locality; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var string |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $_region; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @var string |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $_postal_code; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
protected $_country; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @inheritDoc |
|
62
|
|
|
*/ |
|
63
|
2 |
|
public function getFormatted() |
|
64
|
|
|
{ |
|
65
|
2 |
|
return $this->_formatted; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @inheritDoc |
|
70
|
|
|
*/ |
|
71
|
2 |
|
public function setFormatted($formatted) |
|
72
|
|
|
{ |
|
73
|
2 |
|
$this->_formatted = $formatted; |
|
74
|
2 |
|
return $this; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @inheritDoc |
|
79
|
|
|
*/ |
|
80
|
2 |
|
public function getStreetAddress() |
|
81
|
|
|
{ |
|
82
|
2 |
|
return $this->_street_address; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @inheritDoc |
|
87
|
|
|
*/ |
|
88
|
2 |
|
public function setStreetAddress($street_address) |
|
89
|
|
|
{ |
|
90
|
2 |
|
$this->_street_address = $street_address; |
|
91
|
2 |
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @inheritDoc |
|
96
|
|
|
*/ |
|
97
|
2 |
|
public function getLocality() |
|
98
|
|
|
{ |
|
99
|
2 |
|
return $this->_locality; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @inheritDoc |
|
104
|
|
|
*/ |
|
105
|
2 |
|
public function setLocality($locality) |
|
106
|
|
|
{ |
|
107
|
2 |
|
$this->_locality = $locality; |
|
108
|
2 |
|
return $this; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @inheritDoc |
|
113
|
|
|
*/ |
|
114
|
2 |
|
public function getRegion() |
|
115
|
|
|
{ |
|
116
|
2 |
|
return $this->_region; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @inheritDoc |
|
121
|
|
|
*/ |
|
122
|
2 |
|
public function setRegion($region) |
|
123
|
|
|
{ |
|
124
|
2 |
|
$this->_region = $region; |
|
125
|
2 |
|
return $this; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @inheritDoc |
|
130
|
|
|
*/ |
|
131
|
2 |
|
public function getPostalCode() |
|
132
|
|
|
{ |
|
133
|
2 |
|
return $this->_postal_code; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @inheritDoc |
|
138
|
|
|
*/ |
|
139
|
2 |
|
public function setPostalCode($postal_code) |
|
140
|
|
|
{ |
|
141
|
2 |
|
$this->_postal_code = $postal_code; |
|
142
|
2 |
|
return $this; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
/** |
|
146
|
|
|
* @inheritDoc |
|
147
|
|
|
*/ |
|
148
|
2 |
|
public function getCountry() |
|
149
|
|
|
{ |
|
150
|
2 |
|
return $this->_country; |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* @inheritDoc |
|
155
|
|
|
*/ |
|
156
|
2 |
|
public function setCountry($country) |
|
157
|
|
|
{ |
|
158
|
2 |
|
$this->_country = $country; |
|
159
|
2 |
|
return $this; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* @inheritDoc |
|
164
|
|
|
*/ |
|
165
|
|
|
#[\ReturnTypeWillChange] // Suppress "return type should be compatible" warning. |
|
166
|
1 |
|
public function jsonSerialize() |
|
167
|
|
|
{ |
|
168
|
1 |
|
return [ |
|
169
|
1 |
|
'formatted' => $this->getFormatted(), |
|
170
|
1 |
|
'streetAddress' => $this->getStreetAddress(), |
|
171
|
1 |
|
'locality' => $this->getLocality(), |
|
172
|
1 |
|
'region' => $this->getRegion(), |
|
173
|
1 |
|
'postalCode' => $this->getPostalCode(), |
|
174
|
1 |
|
'country' => $this->getCountry(), |
|
175
|
1 |
|
]; |
|
176
|
|
|
} |
|
177
|
|
|
} |
|
178
|
|
|
|