| @@ 267-296 (lines=30) @@ | ||
| 264 | (string)$xml->atBpost->product |
|
| 265 | ); |
|
| 266 | } |
|
| 267 | if (isset($xml->atBpost->options)) { |
|
| 268 | /** @var \SimpleXMLElement $optionData */ |
|
| 269 | foreach ($xml->atBpost->options as $optionData) { |
|
| 270 | $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); |
|
| 271 | ||
| 272 | if (in_array( |
|
| 273 | $optionData->getName(), |
|
| 274 | array( |
|
| 275 | Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED, |
|
| 276 | Messaging::MESSAGING_TYPE_INFO_NEXT_DAY, |
|
| 277 | Messaging::MESSAGING_TYPE_INFO_REMINDER, |
|
| 278 | Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED, |
|
| 279 | ) |
|
| 280 | ) |
|
| 281 | ) { |
|
| 282 | $option = Messaging::createFromXML($optionData); |
|
| 283 | } else { |
|
| 284 | $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName()); |
|
| 285 | if (!method_exists($className, 'createFromXML')) { |
|
| 286 | throw new BpostNotImplementedException(); |
|
| 287 | } |
|
| 288 | $option = call_user_func( |
|
| 289 | array($className, 'createFromXML'), |
|
| 290 | $optionData |
|
| 291 | ); |
|
| 292 | } |
|
| 293 | ||
| 294 | $atBpost->addOption($option); |
|
| 295 | } |
|
| 296 | } |
|
| 297 | if (isset($xml->atBpost->weight) && $xml->atBpost->weight != '') { |
|
| 298 | $atBpost->setWeight( |
|
| 299 | (int)$xml->atBpost->weight |
|
| @@ 227-253 (lines=27) @@ | ||
| 224 | ); |
|
| 225 | } |
|
| 226 | ||
| 227 | if (isset($nationalXml->options) && !empty($nationalXml->options)) { |
|
| 228 | /** @var \SimpleXMLElement $optionData */ |
|
| 229 | foreach ($nationalXml->options as $optionData) { |
|
| 230 | $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); |
|
| 231 | ||
| 232 | if (in_array($optionData->getName(), array( |
|
| 233 | Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED, |
|
| 234 | Messaging::MESSAGING_TYPE_INFO_NEXT_DAY, |
|
| 235 | Messaging::MESSAGING_TYPE_INFO_REMINDER, |
|
| 236 | Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED, |
|
| 237 | )) |
|
| 238 | ) { |
|
| 239 | $option = Messaging::createFromXML($optionData); |
|
| 240 | } else { |
|
| 241 | $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName()); |
|
| 242 | if (!method_exists($className, 'createFromXML')) { |
|
| 243 | throw new BpostXmlInvalidItemException(); |
|
| 244 | } |
|
| 245 | $option = call_user_func( |
|
| 246 | array($className, 'createFromXML'), |
|
| 247 | $optionData |
|
| 248 | ); |
|
| 249 | } |
|
| 250 | ||
| 251 | $self->addOption($option); |
|
| 252 | } |
|
| 253 | } |
|
| 254 | ||
| 255 | if (isset($nationalXml->weight) && $nationalXml->weight != '') { |
|
| 256 | $self->setWeight( |
|