@@ 10-212 (lines=203) @@ | ||
7 | /** |
|
8 | * @author Ibrahim Hizeoui <[email protected]> |
|
9 | */ |
|
10 | class CustomerBillingAddress implements CreatableFromArray |
|
11 | { |
|
12 | /** |
|
13 | * @var string |
|
14 | */ |
|
15 | private $careOf; |
|
16 | ||
17 | /** |
|
18 | * @var bool |
|
19 | */ |
|
20 | private $useCareOfAsAttention; |
|
21 | ||
22 | /** |
|
23 | * @var string |
|
24 | */ |
|
25 | private $streetAddress; |
|
26 | ||
27 | /** |
|
28 | * @var string |
|
29 | */ |
|
30 | private $zipCode; |
|
31 | ||
32 | /** |
|
33 | * @var string |
|
34 | */ |
|
35 | private $city; |
|
36 | ||
37 | /** |
|
38 | * @var string |
|
39 | */ |
|
40 | private $country; |
|
41 | ||
42 | /** |
|
43 | * @return string |
|
44 | */ |
|
45 | public function getCareOf() |
|
46 | { |
|
47 | return $this->careOf; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @param string $careOf |
|
52 | * |
|
53 | * @return CustomerBillingAddress |
|
54 | */ |
|
55 | public function withCareOf(string $careOf) |
|
56 | { |
|
57 | $new = clone $this; |
|
58 | $new->careOf = $careOf; |
|
59 | ||
60 | return $new; |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @return bool |
|
65 | */ |
|
66 | public function isUseCareOfAsAttention() |
|
67 | { |
|
68 | return $this->useCareOfAsAttention; |
|
69 | } |
|
70 | ||
71 | /** |
|
72 | * @param bool $useCareOfAsAttention |
|
73 | * |
|
74 | * @return CustomerBillingAddress |
|
75 | */ |
|
76 | public function withUseCareOfAsAttention(bool $useCareOfAsAttention) |
|
77 | { |
|
78 | $new = clone $this; |
|
79 | $new->useCareOfAsAttention = $useCareOfAsAttention; |
|
80 | ||
81 | return $new; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * @return string |
|
86 | */ |
|
87 | public function getStreetAddress() |
|
88 | { |
|
89 | return $this->streetAddress; |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * @param string $streetAddress |
|
94 | * |
|
95 | * @return CustomerBillingAddress |
|
96 | */ |
|
97 | public function withStreetAddress(string $streetAddress) |
|
98 | { |
|
99 | $new = clone $this; |
|
100 | $new->streetAddress = $streetAddress; |
|
101 | ||
102 | return $new; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * @return string |
|
107 | */ |
|
108 | public function getZipCode() |
|
109 | { |
|
110 | return $this->zipCode; |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * @param string $zipCode |
|
115 | * |
|
116 | * @return CustomerBillingAddress |
|
117 | */ |
|
118 | public function withZipCode(string $zipCode) |
|
119 | { |
|
120 | $new = clone $this; |
|
121 | $new->zipCode = $zipCode; |
|
122 | ||
123 | return $new; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @return string |
|
128 | */ |
|
129 | public function getCity() |
|
130 | { |
|
131 | return $this->city; |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * @param string $city |
|
136 | * |
|
137 | * @return CustomerBillingAddress |
|
138 | */ |
|
139 | public function withCity(string $city) |
|
140 | { |
|
141 | $new = clone $this; |
|
142 | $new->city = $city; |
|
143 | ||
144 | return $new; |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * @return string |
|
149 | */ |
|
150 | public function getCountry() |
|
151 | { |
|
152 | return $this->country; |
|
153 | } |
|
154 | ||
155 | /** |
|
156 | * @param string $country |
|
157 | * |
|
158 | * @return CustomerBillingAddress |
|
159 | */ |
|
160 | public function withCountry(string $country) |
|
161 | { |
|
162 | $new = clone $this; |
|
163 | $new->country = $country; |
|
164 | ||
165 | return $new; |
|
166 | } |
|
167 | ||
168 | public function toArray() |
|
169 | { |
|
170 | $data = []; |
|
171 | if ($this->careOf !== null) { |
|
172 | $data['careof'] = $this->careOf; |
|
173 | } |
|
174 | if ($this->useCareOfAsAttention !== null) { |
|
175 | $data['use_careof_as_attention'] = $this->useCareOfAsAttention; |
|
176 | } |
|
177 | if ($this->streetAddress !== null) { |
|
178 | $data['street_address'] = $this->streetAddress; |
|
179 | } |
|
180 | if ($this->zipCode !== null) { |
|
181 | $data['zipcode'] = $this->zipCode; |
|
182 | } |
|
183 | if ($this->city !== null) { |
|
184 | $data['city'] = $this->city; |
|
185 | } |
|
186 | if ($this->country !== null) { |
|
187 | $data['country'] = $this->country; |
|
188 | } |
|
189 | ||
190 | return $data; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Create an API response object from the HTTP response from the API server. |
|
195 | * |
|
196 | * @param array $data |
|
197 | * |
|
198 | * @return self |
|
199 | */ |
|
200 | public static function createFromArray(array $data) |
|
201 | { |
|
202 | $model = new self(); |
|
203 | $model->careOf = $data['careof'] ?? null; |
|
204 | $model->useCareOfAsAttention = $data['use_careof_as_attention'] ?? null; |
|
205 | $model->streetAddress = $data['street_address'] ?? null; |
|
206 | $model->zipCode = $data['zipcode'] ?? null; |
|
207 | $model->city = $data['city'] ?? null; |
|
208 | $model->country = $data['country'] ?? null; |
|
209 | ||
210 | return $model; |
|
211 | } |
|
212 | } |
|
213 |
@@ 10-212 (lines=203) @@ | ||
7 | /** |
|
8 | * @author Ibrahim Hizeoui <[email protected]> |
|
9 | */ |
|
10 | class CustomerDeliveryAddress implements CreatableFromArray |
|
11 | { |
|
12 | /** |
|
13 | * @var string |
|
14 | */ |
|
15 | private $name; |
|
16 | ||
17 | /** |
|
18 | * @var string |
|
19 | */ |
|
20 | private $streetAddress; |
|
21 | ||
22 | /** |
|
23 | * @var string |
|
24 | */ |
|
25 | private $careOf; |
|
26 | ||
27 | /** |
|
28 | * @var string |
|
29 | */ |
|
30 | private $zipCode; |
|
31 | ||
32 | /** |
|
33 | * @var string |
|
34 | */ |
|
35 | private $city; |
|
36 | ||
37 | /** |
|
38 | * @var string |
|
39 | */ |
|
40 | private $country; |
|
41 | ||
42 | /** |
|
43 | * @return string |
|
44 | */ |
|
45 | public function getName() |
|
46 | { |
|
47 | return $this->name; |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * @param string $name |
|
52 | * |
|
53 | * @return CustomerDeliveryAddress |
|
54 | */ |
|
55 | public function withName(string $name) |
|
56 | { |
|
57 | $new = clone $this; |
|
58 | $new->name = $name; |
|
59 | ||
60 | return $new; |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @return string |
|
65 | */ |
|
66 | public function getStreetAddress() |
|
67 | { |
|
68 | return $this->streetAddress; |
|
69 | } |
|
70 | ||
71 | /** |
|
72 | * @param string $streetAddress |
|
73 | * |
|
74 | * @return CustomerDeliveryAddress |
|
75 | */ |
|
76 | public function withStreetAddress(string $streetAddress) |
|
77 | { |
|
78 | $new = clone $this; |
|
79 | $new->streetAddress = $streetAddress; |
|
80 | ||
81 | return $new; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * @return string |
|
86 | */ |
|
87 | public function getCareOf() |
|
88 | { |
|
89 | return $this->careOf; |
|
90 | } |
|
91 | ||
92 | /** |
|
93 | * @param string $careOf |
|
94 | * |
|
95 | * @return CustomerDeliveryAddress |
|
96 | */ |
|
97 | public function withCareOf(string $careOf) |
|
98 | { |
|
99 | $new = clone $this; |
|
100 | $new->zipCode = $careOf; |
|
101 | ||
102 | return $new; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * @return string |
|
107 | */ |
|
108 | public function getZipCode() |
|
109 | { |
|
110 | return $this->zipCode; |
|
111 | } |
|
112 | ||
113 | /** |
|
114 | * @param string $zipCode |
|
115 | * |
|
116 | * @return CustomerDeliveryAddress |
|
117 | */ |
|
118 | public function withZipCode(string $zipCode) |
|
119 | { |
|
120 | $new = clone $this; |
|
121 | $new->zipCode = $zipCode; |
|
122 | ||
123 | return $new; |
|
124 | } |
|
125 | ||
126 | /** |
|
127 | * @return string |
|
128 | */ |
|
129 | public function getCity() |
|
130 | { |
|
131 | return $this->city; |
|
132 | } |
|
133 | ||
134 | /** |
|
135 | * @param string $city |
|
136 | * |
|
137 | * @return CustomerDeliveryAddress |
|
138 | */ |
|
139 | public function withCity(string $city) |
|
140 | { |
|
141 | $new = clone $this; |
|
142 | $new->city = $city; |
|
143 | ||
144 | return $new; |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * @return string |
|
149 | */ |
|
150 | public function getCountry() |
|
151 | { |
|
152 | return $this->country; |
|
153 | } |
|
154 | ||
155 | /** |
|
156 | * @param string $country |
|
157 | * |
|
158 | * @return CustomerDeliveryAddress |
|
159 | */ |
|
160 | public function withCountry(string $country) |
|
161 | { |
|
162 | $new = clone $this; |
|
163 | $new->country = $country; |
|
164 | ||
165 | return $new; |
|
166 | } |
|
167 | ||
168 | public function toArray() |
|
169 | { |
|
170 | $data = []; |
|
171 | if ($this->name !== null) { |
|
172 | $data['name'] = $this->name; |
|
173 | } |
|
174 | if ($this->streetAddress !== null) { |
|
175 | $data['street_address'] = $this->streetAddress; |
|
176 | } |
|
177 | if ($this->careOf !== null) { |
|
178 | $data['careof'] = $this->careOf; |
|
179 | } |
|
180 | if ($this->zipCode !== null) { |
|
181 | $data['zipcode'] = $this->zipCode; |
|
182 | } |
|
183 | if ($this->city !== null) { |
|
184 | $data['city'] = $this->city; |
|
185 | } |
|
186 | if ($this->country !== null) { |
|
187 | $data['country'] = $this->country; |
|
188 | } |
|
189 | ||
190 | return $data; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Create an API response object from the HTTP response from the API server. |
|
195 | * |
|
196 | * @param array $data |
|
197 | * |
|
198 | * @return self |
|
199 | */ |
|
200 | public static function createFromArray(array $data) |
|
201 | { |
|
202 | $customerDeliveryAddress = new self(); |
|
203 | $customerDeliveryAddress->name = $data['name'] ?? null; |
|
204 | $customerDeliveryAddress->streetAddress = $data['street_address'] ?? null; |
|
205 | $customerDeliveryAddress->careOf = $data['careof'] ?? null; |
|
206 | $customerDeliveryAddress->zipCode = $data['zipcode'] ?? null; |
|
207 | $customerDeliveryAddress->city = $data['city'] ?? null; |
|
208 | $customerDeliveryAddress->country = $data['country'] ?? null; |
|
209 | ||
210 | return $customerDeliveryAddress; |
|
211 | } |
|
212 | } |
|
213 |