@@ -18,6 +18,14 @@ class AVAddress
18
18
* @var string
19
19
*/
20
20
public $ addressLine ;
21
+ /**
22
+ * @var string
23
+ */
24
+ public $ addressLine2 ;
25
+ /**
26
+ * @var string
27
+ */
28
+ public $ addressLine3 ;
21
29
/**
22
30
* @var string
23
31
*/
@@ -59,14 +67,19 @@ public function __construct(\SimpleXMLElement $xmlDoc)
59
67
$ this ->addressClassification = isset ($ xmlDoc ->AddressClassification ) ? new AddressClassification ($ xmlDoc ->AddressClassification ) : null ;
60
68
$ this ->consigneeName = isset ($ xmlDoc ->ConsigneeName ) ? (string )$ xmlDoc ->ConsigneeName : '' ;
61
69
$ this ->buildingName = isset ($ xmlDoc ->BuildingName ) ? (string )$ xmlDoc ->BuildingName : '' ;
62
- $ this ->addressLine = isset ($ xmlDoc ->AddressLine ) ? (string )$ xmlDoc ->AddressLine : '' ;
63
- $ this ->region = isset ($ xmlDoc ->Region ) ? (string )$ xmlDoc ->Regions : '' ;
70
+ if (isset ($ xmlDoc ->AddressLine )) {
71
+ for ($ i = 0 , $ len = count ($ xmlDoc ->AddressLine ); $ i < $ len ; $ i ++) {
72
+ $ var = 'addressLine ' . ($ i > 0 ? $ i + 1 : '' );
73
+ $ this ->{$ var } = isset ($ xmlDoc ->AddressLine [$ i ]) ? (string ) $ xmlDoc ->AddressLine [$ i ] : '' ;
74
+ }
75
+ }
76
+ $ this ->region = isset ($ xmlDoc ->Region ) ? (string )$ xmlDoc ->Region : '' ;
64
77
$ this ->politicalDivision2 = isset ($ xmlDoc ->PoliticalDivision2 ) ? (string )$ xmlDoc ->PoliticalDivision2 : '' ;
65
78
$ this ->politicalDivision1 = isset ($ xmlDoc ->PoliticalDivision1 ) ? (string )$ xmlDoc ->PoliticalDivision1 : '' ;
66
79
$ this ->postcodePrimaryLow = isset ($ xmlDoc ->PostcodePrimaryLow ) ? (string )$ xmlDoc ->PostcodePrimaryLow : '' ;
67
80
$ this ->postcodeExtendedLow = isset ($ xmlDoc ->PostcodeExtendedLow ) ? (string )$ xmlDoc ->PostcodeExtendedLow : '' ;
68
81
$ this ->urbanization = isset ($ xmlDoc ->Urbanization ) ? (string )$ xmlDoc ->Urbanization : '' ;
69
- $ this ->consigneeName = isset ($ xmlDoc ->CountryCode ) ? (string )$ xmlDoc ->CountryCode : '' ;
82
+ $ this ->countryCode = isset ($ xmlDoc ->CountryCode ) ? (string )$ xmlDoc ->CountryCode : '' ;
70
83
}
71
84
72
85
/**
@@ -83,6 +96,38 @@ public function getCity()
83
96
return $ this ->politicalDivision2 ;
84
97
}
85
98
99
+ /**
100
+ * @return string
101
+ */
102
+ public function getRegion ()
103
+ {
104
+ return $ this ->region ;
105
+ }
106
+
107
+ /**
108
+ * @return string
109
+ */
110
+ public function getConsigneeName ()
111
+ {
112
+ return $ this ->consigneeName ;
113
+ }
114
+
115
+ /**
116
+ * @return string
117
+ */
118
+ public function getUrbanization ()
119
+ {
120
+ return $ this ->urbanization ;
121
+ }
122
+
123
+ /**
124
+ * @return string
125
+ */
126
+ public function getBuildingName ()
127
+ {
128
+ return $ this ->buildingName ;
129
+ }
130
+
86
131
/**
87
132
* @return string
88
133
*/
@@ -111,4 +156,16 @@ public function getPostalCodeWithExtension($divider = '-')
111
156
{
112
157
return $ this ->postcodePrimaryLow . $ divider . $ this ->postcodeExtendedLow ;
113
158
}
159
+
160
+ /**
161
+ * @return string
162
+ *
163
+ * @param int $lineNumber
164
+ * @return string
165
+ */
166
+ public function getAddressLine ($ lineNumber = 1 )
167
+ {
168
+ $ var = 'addressLine ' . ($ lineNumber > 1 ? $ lineNumber : '' );
169
+ return $ this ->{$ var };
170
+ }
114
171
}
0 commit comments