Changeset 3119293
- Timestamp:
- 07/16/2024 02:15:54 PM (21 months ago)
- Location:
- bpost-shipping/trunk
- Files:
-
- 17 added
- 83 edited
-
bpost-shipping.php (modified) (2 diffs)
-
languages/bpost_shipping.pot (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/.github/workflows/test.yml (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/.php-cs-fixer.dist.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/composer.json (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/ApiCaller/ApiCaller.php (modified) (5 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpack247.php (modified) (6 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpack247/Customer.php (modified) (25 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpack247/CustomerPackStation.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost.php (modified) (34 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/CreateLabelBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/CreateLabelForBoxBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/CreateLabelForOrderBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/CreateLabelInBulkForOrdersBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/CreateOrReplaceOrderBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/FetchOrderBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/FetchProductConfigBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/HttpRequestBuilderInterface.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/HttpRequestBuilder/ModifyOrderBuilder.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Label.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Label/Barcode.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Labels.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order.php (modified) (5 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Address.php (modified) (15 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box.php (modified) (14 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/At247.php (modified) (13 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtBpost.php (modified) (12 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtHome.php (modified) (7 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtIntlHome.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtIntlPugo.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/BpostOnAppointment.php (modified) (7 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/CustomsInfo/CustomsInfo.php (modified) (17 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/IBox.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/International (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/International.php (modified) (16 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/International/ParcelContent.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National.php (modified) (12 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National/ParcelLockerReducedMobilityZone.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National/Unregistered.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/OpeningHour/Day.php (modified) (4 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/AutomaticSecondPresentation.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/CashOnDelivery.php (modified) (5 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Insurance.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Insured.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Messaging.php (modified) (10 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Option.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/SaturdayDelivery.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Signature.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Signed.php (added)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Customer.php (modified) (5 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Line.php (modified) (4 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/ParcelsDepotAddress.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/PugoAddress.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Receiver.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/Order/Sender.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Characteristic.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/DeliveryMethod.php (modified) (4 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Option.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Price.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Product.php (modified) (4 diffs)
-
vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Visibility.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/BpostException.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Common/BasicAttribute.php (modified) (5 diffs)
-
vendor/antidot-be/bpost-api-library/src/Common/ComplexAttribute.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Common/IAttribute.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Common/ValidatedValue.php (modified) (4 diffs)
-
vendor/antidot-be/bpost-api-library/src/Common/XmlHelper.php (added)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostApiBusinessException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostApiSystemException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostCurlException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidResponseException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidSelectionException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidXmlResponseException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostTaxipostLocatorException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidDayException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidLengthException.php (modified) (2 diffs)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidPatternException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidValueException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidWeightException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostNotImplementedException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/BpostXmlException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlInvalidItemException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlNoReferenceFoundException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlNoUserIdFoundException.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/FormHandler.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Geo6.php (modified) (22 diffs)
-
vendor/antidot-be/bpost-api-library/src/Geo6/Day.php (modified) (4 diffs)
-
vendor/antidot-be/bpost-api-library/src/Geo6/Poi.php (modified) (18 diffs)
-
vendor/antidot-be/bpost-api-library/src/Geo6/Service.php (modified) (3 diffs)
-
vendor/antidot-be/bpost-api-library/src/Logger.php (modified) (1 diff)
-
vendor/antidot-be/bpost-api-library/src/tijsverkoyen_classes.php (modified) (1 diff)
-
vendor/composer/autoload_psr4.php (modified) (1 diff)
-
vendor/composer/autoload_static.php (modified) (2 diffs)
-
vendor/composer/installed.json (modified) (3 diffs)
-
vendor/composer/installed.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
bpost-shipping/trunk/bpost-shipping.php
r3117106 r3119293 6 6 * Author: bpost 7 7 * Author URI: https://www.bpost.be/ 8 * Version: 3.1. 68 * Version: 3.1.7 9 9 * WC requires at least: 3.0 10 10 * WC tested up to: 8.9 … … 15 15 define( 'BPOST_PLUGIN_DIR', __DIR__ ); 16 16 define( 'BPOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 17 define( 'BPOST_PLUGIN_VERSION', '3.1. 6' );17 define( 'BPOST_PLUGIN_VERSION', '3.1.7' ); 18 18 19 19 /** -
bpost-shipping/trunk/languages/bpost_shipping.pot
r3117106 r3119293 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: bpost shipping 3.1. 6\n"5 "Project-Id-Version: bpost shipping 3.1.7\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/package\n" 7 "POT-Creation-Date: 2024-07-1 2 14:01:54+00:00\n"7 "POT-Creation-Date: 2024-07-16 14:14:10+00:00\n" 8 8 "MIME-Version: 1.0\n" 9 9 "Content-Type: text/plain; charset=UTF-8\n" … … 197 197 msgstr "" 198 198 199 #. #-#-#-#-# bpost_shipping.pot (bpost shipping 3.1. 6) #-#-#-#-#199 #. #-#-#-#-# bpost_shipping.pot (bpost shipping 3.1.7) #-#-#-#-# 200 200 #. Author of the plugin/theme 201 201 #: classes/class-wc-bpost-shipping-method.php:264 -
bpost-shipping/trunk/readme.txt
r3117106 r3119293 8 8 Tested up to: 6.5 9 9 Requires PHP: 7.4 10 Stable tag: 3.1. 610 Stable tag: 3.1.7 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 120 120 5. Configure your bpost shipping settings under the Woocommerce shipping > bpost shipping tab 121 121 == Changelog == 122 123 #### 3.1.7 124 125 *Release date: 2024-07-16* 126 127 * international pickup points could generate an error 122 128 123 129 #### 3.1.6 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/.github/workflows/test.yml
r2890340 r3119293 13 13 php_version: 7.4 14 14 15 - name: php-cs-fixer static analysis16 uses: docker://oskarstark/php-cs-fixer-ga17 with:18 args: --diff --dry-run 15 # - name: php-cs-fixer static analysis 16 # uses: docker://oskarstark/php-cs-fixer-ga 17 # with: 18 # args: --using-cache=no --diff --dry-run -v 19 19 20 20 - name: PHPUnit Tests -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/.php-cs-fixer.dist.php
r2890340 r3119293 5 5 $config = new PhpCsFixer\Config(); 6 6 $rules = array( 7 '@PSR12' => true, 8 'visibility_required' => false, // compatible only with PHP 7.1+ 7 '@Symfony' => true, 8 'visibility_required' => false, // PHP7.1+ 9 'array_syntax' => false, // PHP5.4+ 10 'phpdoc_summary' => false, 11 'phpdoc_annotation_without_dot' => false, 12 'no_superfluous_phpdoc_tags' => false, 13 'yoda_style' => false, 14 'concat_space' => array('spacing' => 'one'), 15 'single_line_throw' => false, 16 'phpdoc_to_comment' => false, 17 'global_namespace_import' => true, 9 18 ); 10 19 $config->setRules($rules); … … 17 26 $finder 18 27 ->in(__DIR__ . '/src') 28 ->in(__DIR__ . '/tests') 19 29 ->notName('tijsverkoyen_classes.php') 20 30 ->sortByName(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/composer.json
r2890340 r3119293 1 1 { 2 2 "name": "antidot-be/bpost-api-library", 3 "version": "3. 4.11",3 "version": "3.5.1", 4 4 "type": "library", 5 5 "description": "bpost API library is a PHP library to communicate with the bpost API.", … … 37 37 "autoload": { 38 38 "psr-4": { 39 "Bpost\\BpostApiClient\\": "src/" 39 "Bpost\\BpostApiClient\\": "src/", 40 "Tests\\": "tests/" 40 41 }, 41 42 "classmap": [ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/ApiCaller/ApiCaller.php
r2890340 r3119293 13 13 /** 14 14 * Class ApiCaller 15 * @package Bpost\BpostApiClient\ApiCaller15 * 16 16 * @codeCoverageIgnore That makes a HTTP request with the bpost API 17 17 */ … … 32 32 /** 33 33 * ApiCaller constructor. 34 * 34 35 * @param Logger $logger 35 36 */ … … 63 64 } 64 65 65 66 66 /** 67 67 * @param array $options 68 * 68 69 * @return bool 70 * 69 71 * @throws BpostApiBusinessException 70 72 * @throws BpostApiResponseException … … 93 95 'status' => $errorNumber . ' (' . $errorMessage . ')', 94 96 'headers' => $headers, 95 'response' => $this->responseBody 97 'response' => $this->responseBody, 96 98 )); 97 99 … … 122 124 public function getHttpCodeType() 123 125 { 124 return 100 * (int) ($this->responseHttpCode / 100);126 return 100 * (int) ($this->responseHttpCode / 100); 125 127 } 126 128 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpack247.php
r2890340 r3119293 8 8 use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostCurlException; 9 9 use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidResponseException; 10 use DOMDocument; 11 use SimpleXMLElement; 10 12 11 13 /** … … 13 15 * 14 16 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 17 * 15 18 * @version 3.0.0 19 * 16 20 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 17 21 * @license BSD License … … 70 74 * Make the call 71 75 * 72 * @param string $url The URL to call. 73 * @param string $body The data to pass. 74 * @param string $method The HTTP-method to use. 75 * @return \SimpleXMLElement 76 * @param string $url The URL to call. 77 * @param string $body The data to pass. 78 * @param string $method The HTTP-method to use. 79 * 80 * @return SimpleXMLElement 81 * 76 82 * @throws BpostApiBusinessException 77 83 * @throws BpostApiSystemException … … 223 229 * @param Customer $customer 224 230 * 225 * @return \SimpleXMLElement 231 * @return SimpleXMLElement 232 * 226 233 * @throws BpostApiBusinessException 227 234 * @throws BpostApiSystemException … … 233 240 $url = '/customer'; 234 241 235 $document = new \DOMDocument('1.0', 'utf-8');242 $document = new DOMDocument('1.0', 'utf-8'); 236 243 $document->preserveWhiteSpace = false; 237 244 $document->formatOutput = true; … … 253 260 * Retrieve member information 254 261 * 255 * @param string $id262 * @param string $id 256 263 * 257 264 * @return Customer 265 * 258 266 * @throws BpostApiBusinessException 259 267 * @throws BpostApiSystemException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpack247/Customer.php
r2890340 r3119293 5 5 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 6 6 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlNoUserIdFoundException; 7 use DateTime; 8 use DOMDocument; 9 use DOMElement; 10 use SimpleXMLElement; 7 11 8 12 /** … … 101 105 102 106 /** 103 * @var \DateTime107 * @var DateTime 104 108 */ 105 109 private $dateOfBirth; … … 131 135 132 136 /** 133 * @param bool ean$activated137 * @param bool $activated 134 138 */ 135 139 public function setActivated($activated) … … 139 143 140 144 /** 141 * @return bool ean145 * @return bool 142 146 */ 143 147 public function getActivated() … … 163 167 164 168 /** 165 * @param \DateTime $dateOfBirth169 * @param DateTime $dateOfBirth 166 170 */ 167 171 public function setDateOfBirth($dateOfBirth) … … 171 175 172 176 /** 173 * @return \DateTime177 * @return DateTime 174 178 */ 175 179 public function getDateOfBirth() … … 227 231 228 232 /** 229 * @param bool ean$isComfortZoneUser233 * @param bool $isComfortZoneUser 230 234 */ 231 235 public function setIsComfortZoneUser($isComfortZoneUser) … … 235 239 236 240 /** 237 * @return bool ean241 * @return bool 238 242 */ 239 243 public function getIsComfortZoneUser() … … 307 311 308 312 /** 309 * @param bool ean$optIn313 * @param bool $optIn 310 314 */ 311 315 public function setOptIn($optIn) … … 315 319 316 320 /** 317 * @return bool ean321 * @return bool 318 322 */ 319 323 public function getOptIn() … … 364 368 /** 365 369 * @param string $preferredLanguage 370 * 366 371 * @throws BpostInvalidValueException 367 372 */ … … 400 405 401 406 /** 402 * @param bool ean$receivePromotions407 * @param bool $receivePromotions 403 408 */ 404 409 public function setReceivePromotions($receivePromotions) … … 408 413 409 414 /** 410 * @return bool ean415 * @return bool 411 416 */ 412 417 public function getReceivePromotions() … … 433 438 /** 434 439 * @param string $title 440 * 435 441 * @throws BpostInvalidValueException 436 442 */ … … 480 486 481 487 /** 482 * @param bool ean$useInformationForThirdParty488 * @param bool $useInformationForThirdParty 483 489 */ 484 490 public function setUseInformationForThirdParty($useInformationForThirdParty) … … 488 494 489 495 /** 490 * @return bool ean496 * @return bool 491 497 */ 492 498 public function getUseInformationForThirdParty() … … 530 536 * Return the object as an array for usage in the XML 531 537 * 532 * @param \DOMDocument $document 533 * @return \DOMElement 534 */ 535 public function toXML(\DOMDocument $document) 538 * @param DOMDocument $document 539 * 540 * @return DOMElement 541 */ 542 public function toXML(DOMDocument $document) 536 543 { 537 544 $customer = $document->createElement( … … 564 571 565 572 /** 566 * @param \SimpleXMLElement $xml573 * @param SimpleXMLElement $xml 567 574 * 568 575 * @return Customer 576 * 569 577 * @throws BpostInvalidValueException 570 578 * @throws BpostXmlNoUserIdFoundException 571 579 */ 572 public static function createFromXML( \SimpleXMLElement $xml)580 public static function createFromXML(SimpleXMLElement $xml) 573 581 { 574 582 // @todo work with classmaps ... … … 598 606 } 599 607 if (isset($xml->DateOfBirth) && $xml->DateOfBirth != '') { 600 $dateTime = new \DateTime((string) $xml->DateOfBirth);608 $dateTime = new DateTime((string) $xml->DateOfBirth); 601 609 $customer->setDateOfBirth($dateTime); 602 610 } … … 660 668 661 669 /** 662 * @param \DOMDocument $document663 * @param \DOMElement$customer664 */ 665 private function namingToXML( \DOMDocument $document, \DOMElement $customer)670 * @param DOMDocument $document 671 * @param DOMElement $customer 672 */ 673 private function namingToXML(DOMDocument $document, DOMElement $customer) 666 674 { 667 675 if ($this->getFirstName() !== null) { … … 684 692 685 693 /** 686 * @param \DOMDocument $document687 * @param \DOMElement$customer688 */ 689 private function contactToXML( \DOMDocument $document, \DOMElement $customer)694 * @param DOMDocument $document 695 * @param DOMElement $customer 696 */ 697 private function contactToXML(DOMDocument $document, DOMElement $customer) 690 698 { 691 699 if ($this->getEmail() !== null) { … … 716 724 717 725 /** 718 * @param \DOMDocument $document719 * @param \DOMElement$customer720 */ 721 private function addressToXML( \DOMDocument $document, \DOMElement $customer)726 * @param DOMDocument $document 727 * @param DOMElement $customer 728 */ 729 private function addressToXML(DOMDocument $document, DOMElement $customer) 722 730 { 723 731 if ($this->getStreet() !== null) { … … 740 748 741 749 /** 742 * @param \DOMDocument $document743 * @param \DOMElement$customer744 */ 745 private function preferredLanguageToXML( \DOMDocument $document, \DOMElement $customer)750 * @param DOMDocument $document 751 * @param DOMElement $customer 752 */ 753 private function preferredLanguageToXML(DOMDocument $document, DOMElement $customer) 746 754 { 747 755 if ($this->getPreferredLanguage() !== null) { … … 756 764 757 765 /** 758 * @param \DOMDocument $document759 * @param \DOMElement$customer760 */ 761 private function titleToXML( \DOMDocument $document, \DOMElement $customer)766 * @param DOMDocument $document 767 * @param DOMElement $customer 768 */ 769 private function titleToXML(DOMDocument $document, DOMElement $customer) 762 770 { 763 771 if ($this->getTitle() !== null) { … … 772 780 773 781 /** 774 * @param \DOMDocument $document775 * @param \DOMElement$customer776 */ 777 private function postalCodeToXML( \DOMDocument $document, \DOMElement $customer)782 * @param DOMDocument $document 783 * @param DOMElement $customer 784 */ 785 private function postalCodeToXML(DOMDocument $document, DOMElement $customer) 778 786 { 779 787 if ($this->getPostalCode() !== null) { -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpack247/CustomerPackStation.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpack247; 4 5 use SimpleXMLElement; 4 6 5 7 /** … … 74 76 75 77 /** 76 * @param \SimpleXMLElement $xml 78 * @param SimpleXMLElement $xml 79 * 77 80 * @return CustomerPackStation 78 81 */ 79 public static function createFromXML( \SimpleXMLElement $xml)82 public static function createFromXML(SimpleXMLElement $xml) 80 83 { 81 84 $packStation = new CustomerPackStation(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost.php
r2890340 r3119293 4 4 5 5 use Bpost\BpostApiClient\ApiCaller\ApiCaller; 6 use Bpost\BpostApiClient\Bpost\CreateLabelInBulkForOrders; 6 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateLabelForBoxBuilder; 7 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateLabelForOrderBuilder; 8 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateLabelInBulkForOrdersBuilder; 9 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateOrReplaceOrderBuilder; 10 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\FetchOrderBuilder; 11 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\FetchProductConfigBuilder; 12 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\HttpRequestBuilderInterface; 13 use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\ModifyOrderBuilder; 7 14 use Bpost\BpostApiClient\Bpost\Labels; 8 15 use Bpost\BpostApiClient\Bpost\Order; 9 16 use Bpost\BpostApiClient\Bpost\Order\Box; 10 use Bpost\BpostApiClient\Bpost\Order\Box\Option\Insur ance;17 use Bpost\BpostApiClient\Bpost\Order\Box\Option\Insured; 11 18 use Bpost\BpostApiClient\Bpost\ProductConfiguration; 12 19 use Bpost\BpostApiClient\Common\ValidatedValue\LabelFormat; … … 16 23 use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidXmlResponseException; 17 24 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 25 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 18 26 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException; 27 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlNoReferenceFoundException; 19 28 use Psr\Log\LoggerInterface; 29 use SimpleXMLElement; 20 30 21 31 /** … … 23 33 * 24 34 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 35 * 25 36 * @version 3.0.0 37 * 26 38 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 27 39 * @license BSD License … … 33 45 34 46 // URL for the api 35 const API_URL = 'https:// api-parcel.bpost.be/services/shm';47 const API_URL = 'https://shm-rest.bpost.cloud/services/shm'; 36 48 37 49 // current version … … 91 103 private $apiUrl; 92 104 93 /** @var Logger */105 /** @var Logger */ 94 106 private $logger; 95 107 96 // class methods97 108 /** 98 109 * Create Bpost instance … … 104 115 public function __construct($accountId, $passPhrase, $apiUrl = self::API_URL) 105 116 { 106 $this->accountId = (string) $accountId;107 $this->passPhrase = (string) $passPhrase;108 $this->apiUrl = (string) $apiUrl;117 $this->accountId = (string) $accountId; 118 $this->passPhrase = (string) $passPhrase; 119 $this->apiUrl = (string) $apiUrl; 109 120 $this->logger = new Logger(); 110 121 } … … 118 129 $this->apiCaller = new ApiCaller($this->logger); 119 130 } 131 120 132 return $this->apiCaller; 121 133 } … … 143 155 * Decode the response 144 156 * 145 * @param \SimpleXMLElement $item The item to decode. 146 * @param array $return Just a placeholder. 147 * @param int $i A internal counter. 157 * @param SimpleXMLElement $item The item to decode. 158 * @param array $return Just a placeholder. 159 * @param int $i A internal counter. 160 * 148 161 * @return array 162 * 149 163 * @throws BpostXmlInvalidItemException 150 164 */ 151 165 private static function decodeResponse($item, $return = null, $i = 0) 152 166 { 153 if (!$item instanceof \SimpleXMLElement) {167 if (!$item instanceof SimpleXMLElement) { 154 168 throw new BpostXmlInvalidItemException(); 155 169 } … … 158 172 'barcode', 159 173 'orderLine', 160 Insur ance::INSURANCE_TYPE_ADDITIONAL_INSURANCE,174 Insured::INSURANCE_TYPE_ADDITIONAL_INSURANCE, 161 175 Box\Option\Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED, 162 'infoPugo' 176 'infoPugo', 163 177 ); 164 178 $integerKeys = array('totalPrice'); 165 179 166 /** @var \SimpleXMLElement $value */180 /** @var SimpleXMLElement $value */ 167 181 foreach ($item as $key => $value) { 168 $attributes = (array) $value->attributes();182 $attributes = (array) $value->attributes(); 169 183 170 184 if (!empty($attributes) && isset($attributes['@attributes'])) { … … 173 187 174 188 // empty 175 if (isset($value['nil']) && (string) $value['nil'] === 'true') {189 if (isset($value['nil']) && (string) $value['nil'] === 'true') { 176 190 $return[$key] = null; 177 191 } // empty 178 elseif (isset($value[0]) && (string) $value == '') {192 elseif (isset($value[0]) && (string) $value == '') { 179 193 if (in_array($key, $arrayKeys)) { 180 194 $return[$key][] = self::decodeResponse($value); … … 185 199 // arrays 186 200 if (in_array($key, $arrayKeys)) { 187 $return[$key][] = (string) $value;201 $return[$key][] = (string) $value; 188 202 } // booleans 189 elseif ((string) $value == 'true') {203 elseif ((string) $value == 'true') { 190 204 $return[$key] = true; 191 } elseif ((string) $value == 'false') {205 } elseif ((string) $value == 'false') { 192 206 $return[$key] = false; 193 207 } // integers 194 208 elseif (in_array($key, $integerKeys)) { 195 $return[$key] = (int) $value;209 $return[$key] = (int) $value; 196 210 } // fallback to string 197 211 else { 198 $return[$key] = (string) $value;212 $return[$key] = (string) $value; 199 213 } 200 214 } … … 207 221 * Make the call 208 222 * 209 * @param string $url The URL to call. 210 * @param string $body The data to pass. 211 * @param array $headers The headers to pass. 212 * @param string $method The HTTP-method to use. 213 * @param bool $expectXML Do we expect XML? 214 * @return mixed 215 * @throws BpostCurlException 216 * @throws BpostInvalidResponseException 217 * @throws BpostInvalidSelectionException 218 * @throws BpostInvalidXmlResponseException 219 */ 220 private function doCall($url, $body = null, $headers = array(), $method = 'GET', $expectXML = true) 221 { 223 * @return string|SimpleXMLElement 224 * 225 * @throws BpostCurlException 226 * @throws BpostInvalidResponseException 227 * @throws BpostInvalidSelectionException 228 * @throws BpostInvalidXmlResponseException 229 */ 230 private function doCall(HttpRequestBuilderInterface $builder) 231 { 232 $headers = $builder->getHeaders(); 233 222 234 // build Authorization header 223 235 $headers[] = 'Authorization: Basic ' . $this->getAuthorizationHeader(); … … 225 237 // set options 226 238 $options = array(); 227 $options[CURLOPT_URL] = $this->apiUrl . '/' . $this->accountId . $ url;239 $options[CURLOPT_URL] = $this->apiUrl . '/' . $this->accountId . $builder->getUrl(); 228 240 if ($this->getPort() != 0) { 229 241 $options[CURLOPT_PORT] = $this->getPort(); … … 231 243 $options[CURLOPT_USERAGENT] = $this->getUserAgent(); 232 244 $options[CURLOPT_RETURNTRANSFER] = true; 233 $options[CURLOPT_TIMEOUT] = (int) $this->getTimeOut();245 $options[CURLOPT_TIMEOUT] = (int) $this->getTimeOut(); 234 246 $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; 235 247 $options[CURLOPT_HTTPHEADER] = $headers; 236 248 237 if ($ method== 'POST') {249 if ($builder->getMethod() == 'POST') { 238 250 $options[CURLOPT_POST] = true; 239 $options[CURLOPT_POSTFIELDS] = $b ody;251 $options[CURLOPT_POSTFIELDS] = $builder->getXml(); 240 252 } 241 253 … … 255 267 ) { 256 268 // message 257 $message = (string) $xml->error;258 $code = isset($xml->code) ? (int) $xml->code : null;269 $message = (string) $xml->error; 270 $code = isset($xml->code) ? (int) $xml->code : null; 259 271 260 272 // throw exception … … 265 277 if ( 266 278 ($contentType !== null && substr_count($contentType, 'text/plain') > 0) || 267 (in_array($httpCode, array(400, 404)))279 in_array($httpCode, array(400, 404)) 268 280 ) { 269 281 $message = $response; … … 274 286 275 287 // if we don't expect XML we can return the content here 276 if (!$ expectXML) {288 if (!$builder->isExpectXml()) { 277 289 return $response; 278 290 } … … 325 337 public function getPort() 326 338 { 327 return (int) $this->port;339 return (int) $this->port; 328 340 } 329 341 … … 335 347 public function getTimeOut() 336 348 { 337 return (int) $this->timeOut;349 return (int) $this->timeOut; 338 350 } 339 351 … … 347 359 public function getUserAgent() 348 360 { 349 return (string) 'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent;361 return (string) 'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent; 350 362 } 351 363 … … 358 370 public function setTimeOut($seconds) 359 371 { 360 $this->timeOut = (int) $seconds;372 $this->timeOut = (int) $seconds; 361 373 } 362 374 … … 369 381 public function setUserAgent($userAgent) 370 382 { 371 $this->userAgent = (string) $userAgent;383 $this->userAgent = (string) $userAgent; 372 384 } 373 385 … … 377 389 * Creates a new order. If an order with the same orderReference already exists 378 390 * 379 * @param Order $order391 * @param Order $order 380 392 * 381 393 * @return bool 382 * @throws BpostCurlException 383 * @throws BpostInvalidResponseException 384 * @throws BpostInvalidSelectionException 394 * 395 * @throws BpostCurlException 396 * @throws BpostInvalidResponseException 397 * @throws BpostInvalidSelectionException 398 * @throws BpostInvalidXmlResponseException 385 399 */ 386 400 public function createOrReplaceOrder(Order $order) 387 401 { 388 $url = '/orders'; 389 390 $document = new \DOMDocument('1.0', 'utf-8'); 391 $document->preserveWhiteSpace = false; 392 $document->formatOutput = true; 393 394 $document->appendChild( 395 $order->toXML( 396 $document, 397 $this->accountId 398 ) 399 ); 400 401 $headers = array( 402 'Content-type: application/vnd.bpost.shm-order-v3.3+XML' 403 ); 404 405 return ( 406 $this->doCall( 407 $url, 408 $document->saveXML(), 409 $headers, 410 'POST', 411 false 412 ) == '' 413 ); 402 $builder = new CreateOrReplaceOrderBuilder($order, $this->accountId); 403 404 return $this->doCall($builder) == ''; 414 405 } 415 406 … … 417 408 * Fetch an order 418 409 * 419 * @param $reference410 * @param string $reference 420 411 * 421 412 * @return Order 422 * @throws BpostCurlException 423 * @throws BpostInvalidResponseException 424 * @throws BpostInvalidSelectionException 425 * @throws Exception\XmlException\BpostXmlNoReferenceFoundException 413 * 414 * @throws BpostCurlException 415 * @throws BpostInvalidResponseException 416 * @throws BpostInvalidSelectionException 417 * @throws BpostInvalidXmlResponseException 418 * @throws BpostNotImplementedException 419 * @throws BpostXmlNoReferenceFoundException 426 420 */ 427 421 public function fetchOrder($reference) 428 422 { 429 $url = '/orders/' . (string)$reference; 430 431 $headers = array( 432 'Accept: application/vnd.bpost.shm-order-v3.3+XML', 433 ); 434 $xml = $this->doCall( 435 $url, 436 null, 437 $headers 438 ); 423 $builder = new FetchOrderBuilder($reference); 424 425 $xml = $this->doCall($builder); 439 426 440 427 return Order::createFromXML($xml); … … 445 432 * 446 433 * @return ProductConfiguration 447 * @throws BpostCurlException 448 * @throws BpostInvalidResponseException 449 * @throws BpostInvalidSelectionException 434 * 435 * @throws BpostCurlException 436 * @throws BpostInvalidResponseException 437 * @throws BpostInvalidSelectionException 438 * @throws BpostInvalidXmlResponseException 450 439 */ 451 440 public function fetchProductConfig() 452 441 { 453 $url = '/productconfig'; 454 455 $headers = array( 456 'Accept: application/vnd.bpost.shm-productConfiguration-v3.1+XML', 457 ); 458 /** @var \SimpleXMLElement $xml */ 459 $xml = $this->doCall( 460 $url, 461 null, 462 $headers 463 ); 442 $builder = new FetchProductConfigBuilder(); 443 444 $xml = $this->doCall($builder); 464 445 465 446 return ProductConfiguration::createFromXML($xml); … … 469 450 * Modify the status for an order. 470 451 * 471 * @param string $reference The reference for an order472 * @param string $status The new status, allowed values are: OPEN, PENDING, CANCELLED, COMPLETED, ON-HOLD or PRINTED452 * @param string $reference The reference for an order 453 * @param string $status The new status, allowed values are: OPEN, PENDING, CANCELLED, COMPLETED, ON-HOLD or PRINTED 473 454 * 474 455 * @return bool 456 * 475 457 * @throws BpostCurlException 476 458 * @throws BpostInvalidResponseException 477 459 * @throws BpostInvalidSelectionException 478 460 * @throws BpostInvalidValueException 461 * @throws BpostInvalidXmlResponseException 479 462 */ 480 463 public function modifyOrderStatus($reference, $status) 481 464 { 482 $status = strtoupper($status); 483 if (!in_array($status, Box::getPossibleStatusValues())) { 484 throw new BpostInvalidValueException('status', $status, Box::getPossibleStatusValues()); 485 } 486 487 $url = '/orders/' . $reference; 488 489 $document = new \DOMDocument('1.0', 'utf-8'); 490 $document->preserveWhiteSpace = false; 491 $document->formatOutput = true; 492 493 $orderUpdate = $document->createElement('orderUpdate'); 494 $orderUpdate->setAttribute('xmlns', 'http://schema.post.be/shm/deepintegration/v3/'); 495 $orderUpdate->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); 496 $orderUpdate->appendChild( 497 $document->createElement('status', $status) 498 ); 499 $document->appendChild($orderUpdate); 500 501 $headers = array( 502 'Content-type: application/vnd.bpost.shm-orderUpdate-v3+XML' 503 ); 504 505 return ( 506 $this->doCall( 507 $url, 508 $document->saveXML(), 509 $headers, 510 'POST', 511 false 512 ) == '' 513 ); 465 $builder = new ModifyOrderBuilder($reference, $status); 466 467 return $this->doCall($builder) == ''; 514 468 } 515 469 516 470 // labels 471 517 472 /** 518 473 * Get the possible label formats … … 529 484 530 485 /** 531 * Generic method to centralize handling of labels532 *533 * @param string $url534 * @param string $format535 * @param bool $withReturnLabels536 * @param bool $asPdf537 *538 * @return Bpost\Label[]539 * @throws BpostCurlException540 * @throws BpostInvalidResponseException541 * @throws BpostInvalidSelectionException542 * @throws BpostInvalidValueException543 */544 protected function getLabel($url, $format = self::LABEL_FORMAT_A6, $withReturnLabels = false, $asPdf = false)545 {546 $format = strtoupper($format);547 if (!in_array($format, self::getPossibleLabelFormatValues())) {548 throw new BpostInvalidValueException('format', $format, self::getPossibleLabelFormatValues());549 }550 551 $url .= '/labels/' . $format;552 if ($withReturnLabels) {553 $url .= '/withReturnLabels';554 }555 556 if ($asPdf) {557 $headers = array(558 'Accept: application/vnd.bpost.shm-label-pdf-v3.4+XML'559 );560 } else {561 $headers = array(562 'Accept: application/vnd.bpost.shm-label-image-v3.4+XML',563 );564 }565 566 $xml = $this->doCall(567 $url,568 null,569 $headers570 );571 572 return Labels::createFromXML($xml);573 }574 575 /**576 486 * Create the labels for all unprinted boxes in an order. 577 487 * The service will return labels for all unprinted boxes for that order. … … 579 489 * had already been printed will remain the same. 580 490 * 581 * @param string $reference The reference for an order582 * @param string $format The desired format, allowed values are: A4, A6583 * @param bool $withReturnLabels Should return labels be returned?584 * @param bool $asPdf Should we retrieve the PDF-version instead of PNG491 * @param string $reference The reference for an order 492 * @param string $format The desired format, allowed values are: A4, A6 493 * @param bool $withReturnLabels Should return labels be returned? 494 * @param bool $asPdf Should we retrieve the PDF-version instead of PNG 585 495 * 586 496 * @return Bpost\Label[] 587 * @throws BpostInvalidValueException 497 * 498 * @throws BpostCurlException 499 * @throws BpostInvalidResponseException 500 * @throws BpostInvalidSelectionException 501 * @throws BpostInvalidXmlResponseException 588 502 */ 589 503 public function createLabelForOrder( … … 593 507 $asPdf = false 594 508 ) { 595 $url = '/orders/' . (string)$reference; 596 597 return $this->getLabel($url, $format, $withReturnLabels, $asPdf); 509 $builder = new CreateLabelForOrderBuilder($reference, new LabelFormat($format), $asPdf, $withReturnLabels); 510 511 $xml = $this->doCall($builder); 512 513 return Labels::createFromXML($xml); 598 514 } 599 515 … … 601 517 * Create a label for a known barcode. 602 518 * 603 * @param string $barcode The barcode of the parcel604 * @param string $format The desired format, allowed values are: A4, A6605 * @param bool $withReturnLabels Should return labels be returned?606 * @param bool $asPdf Should we retrieve the PDF-version instead of PNG519 * @param string $barcode The barcode of the parcel 520 * @param string $format The desired format, allowed values are: A4, A6 521 * @param bool $withReturnLabels Should return labels be returned? 522 * @param bool $asPdf Should we retrieve the PDF-version instead of PNG 607 523 * 608 524 * @return Bpost\Label[] 609 * @throws BpostInvalidValueException 525 * 526 * @throws BpostCurlException 527 * @throws BpostInvalidResponseException 528 * @throws BpostInvalidSelectionException 529 * @throws BpostInvalidXmlResponseException 610 530 */ 611 531 public function createLabelForBox( … … 615 535 $asPdf = false 616 536 ) { 617 $url = '/boxes/' . (string)$barcode; 618 619 return $this->getLabel($url, $format, $withReturnLabels, $asPdf); 537 $builder = new CreateLabelForBoxBuilder($barcode, new LabelFormat($format), $asPdf, $withReturnLabels); 538 539 $xml = $this->doCall($builder); 540 541 return Labels::createFromXML($xml); 620 542 } 621 543 … … 626 548 * a certain box was not yet printed, it will have the status PRINTED 627 549 * 628 * @param array $references The references for the order629 * @param string $format The desired format, allowed values are: A4, A6630 * @param bool $withReturnLabels Should return labels be returned?631 * @param bool $asPdf Should we retrieve the PDF-version instead of PNG632 * @param bool $forcePrinting Reprint a already printed label550 * @param array $references The references for the order 551 * @param string $format The desired format, allowed values are: A4, A6 552 * @param bool $withReturnLabels Should return labels be returned? 553 * @param bool $asPdf Should we retrieve the PDF-version instead of PNG 554 * @param bool $forcePrinting Reprint a already printed label 633 555 * 634 556 * @return Bpost\Label[] 635 * @throws BpostCurlException 636 * @throws BpostInvalidResponseException 637 * @throws BpostInvalidSelectionException 638 * @throws BpostInvalidValueException 557 * 558 * @throws BpostCurlException 559 * @throws BpostInvalidResponseException 560 * @throws BpostInvalidSelectionException 561 * @throws BpostInvalidXmlResponseException 639 562 */ 640 563 public function createLabelInBulkForOrders( … … 645 568 $forcePrinting = false 646 569 ) { 647 $createLabelInBulkForOrders = new CreateLabelInBulkForOrders(); 648 649 $xml = $this->doCall( 650 $createLabelInBulkForOrders->getUrl(new LabelFormat($format), $withReturnLabels, $forcePrinting), 651 $createLabelInBulkForOrders->getXml($references), 652 $createLabelInBulkForOrders->getHeaders($asPdf), 653 'POST' 570 $builder = new CreateLabelInBulkForOrdersBuilder( 571 $references, 572 new LabelFormat($format), 573 $asPdf, 574 $withReturnLabels, 575 $forcePrinting 654 576 ); 655 577 578 $xml = $this->doCall($builder); 579 656 580 return Labels::createFromXML($xml); 657 581 } … … 669 593 /** 670 594 * @param int $weight in grams 595 * 671 596 * @return bool 672 597 */ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Label.php
r2890340 r3119293 5 5 use Bpost\BpostApiClient\Bpost\Label\Barcode; 6 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 7 use SimpleXMLElement; 7 8 8 9 /** … … 88 89 /** 89 90 * @param string $mimeType 91 * 90 92 * @throws BpostInvalidValueException 91 93 */ … … 130 132 131 133 /** 132 * @param \SimpleXMLElement $xml134 * @param SimpleXMLElement $xml 133 135 * 134 136 * @return Label 137 * 135 138 * @throws BpostInvalidValueException 136 139 */ 137 public static function createFromXML( \SimpleXMLElement $xml)140 public static function createFromXML(SimpleXMLElement $xml) 138 141 { 139 142 $label = new Label(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Label/Barcode.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Label; 4 4 5 use SimpleXMLElement; 6 5 7 /** 6 8 * Class Barcode 7 * @package Bpost\BpostApiClient\Bpost\Label8 9 */ 9 10 class Barcode … … 24 25 public function setBarcode($barcode) 25 26 { 26 $this->barcode = (string) $barcode;27 $this->barcode = (string) $barcode; 27 28 } 28 29 … … 52 53 53 54 /** 54 * @param \SimpleXMLElement $xml55 * @param SimpleXMLElement $xml 55 56 * 56 57 * @return self 57 58 */ 58 public static function createFromXML( \SimpleXMLElement $xml)59 public static function createFromXML(SimpleXMLElement $xml) 59 60 { 60 61 $self = new self(); 61 62 if (isset($xml->barcode) && $xml->barcode != '') { 62 $self->setBarcode((string) $xml->barcode);63 $self->setBarcode((string) $xml->barcode); 63 64 } 64 65 if (isset($xml->reference) && $xml->reference != '') { 65 $self->setReference((string) $xml->reference);66 $self->setReference((string) $xml->reference); 66 67 } 67 68 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Labels.php
r1467688 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost; 4 5 use SimpleXMLElement; 4 6 5 7 /** … … 9 11 { 10 12 /** 11 * @param \SimpleXMLElement $xml13 * @param SimpleXMLElement $xml 12 14 * 13 15 * @return Label[] 14 16 */ 15 public static function createFromXML( \SimpleXMLElement $xml)17 public static function createFromXML(SimpleXMLElement $xml) 16 18 { 17 19 $labels = array(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order.php
r1467688 r3119293 7 7 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 8 8 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlNoReferenceFoundException; 9 use DOMDocument; 10 use DOMElement; 11 use SimpleXMLElement; 9 12 10 13 /** … … 146 149 * Return the object as an array for usage in the XML 147 150 * 148 * @param \DOMDocument $document 149 * @param string $accountId 150 * @return \DOMElement 151 */ 152 public function toXML(\DOMDocument $document, $accountId) 151 * @param DOMDocument $document 152 * @param string $accountId 153 * 154 * @return DOMElement 155 */ 156 public function toXML(DOMDocument $document, $accountId) 153 157 { 154 158 $order = $document->createElement( … … 157 161 $order->setAttribute( 158 162 'xmlns:common', 159 'http://schema.post.be/shm/deepintegration/v 3/common'163 'http://schema.post.be/shm/deepintegration/v5/common' 160 164 ); 161 165 $order->setAttribute( 162 166 'xmlns:tns', 163 'http://schema.post.be/shm/deepintegration/v 3/'167 'http://schema.post.be/shm/deepintegration/v5/' 164 168 ); 165 169 $order->setAttribute( 166 170 'xmlns', 167 'http://schema.post.be/shm/deepintegration/v 3/national'171 'http://schema.post.be/shm/deepintegration/v5/national' 168 172 ); 169 173 $order->setAttribute( 170 174 'xmlns:international', 171 'http://schema.post.be/shm/deepintegration/v 3/international'175 'http://schema.post.be/shm/deepintegration/v5/international' 172 176 ); 173 177 $order->setAttribute( … … 177 181 $order->setAttribute( 178 182 'xsi:schemaLocation', 179 'http://schema.post.be/shm/deepintegration/v 3/'183 'http://schema.post.be/shm/deepintegration/v5/' 180 184 ); 181 185 … … 230 234 231 235 /** 232 * @param \SimpleXMLElement $xml236 * @param SimpleXMLElement $xml 233 237 * 234 238 * @return Order 239 * 235 240 * @throws BpostXmlNoReferenceFoundException 236 241 * @throws BpostNotImplementedException 237 242 */ 238 public static function createFromXML( \SimpleXMLElement $xml)243 public static function createFromXML(SimpleXMLElement $xml) 239 244 { 240 245 // @todo work with classmaps ... -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Address.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; 7 use DOMDocument; 8 use DOMElement; 9 use SimpleXMLElement; 6 10 7 11 /** … … 46 50 /** 47 51 * @param string $box 52 * 48 53 * @throws BpostInvalidLengthException 49 54 */ … … 67 72 /** 68 73 * @param string $countryCode 74 * 69 75 * @throws BpostInvalidLengthException 70 76 */ … … 88 94 /** 89 95 * @param string $locality 96 * 90 97 * @throws BpostInvalidLengthException 91 98 */ … … 109 116 /** 110 117 * @param string $number 118 * 111 119 * @throws BpostInvalidLengthException 112 120 */ … … 130 138 /** 131 139 * @param string $postalCode 140 * 132 141 * @throws BpostInvalidLengthException 133 142 */ … … 151 160 /** 152 161 * @param string $streetName 162 * 153 163 * @throws BpostInvalidLengthException 154 164 */ … … 211 221 * Return the object as an array for usage in the XML 212 222 * 213 * @param \DOMDocument $document 214 * @param string $prefix 215 * @return \DOMElement 216 */ 217 public function toXML(\DOMDocument $document, $prefix = 'common') 223 * @param DOMDocument $document 224 * @param string $prefix 225 * 226 * @return DOMElement 227 */ 228 public function toXML(DOMDocument $document, $prefix = 'common') 218 229 { 219 230 $tagName = static::TAG_NAME; … … 230 241 231 242 /** 232 * @param \SimpleXMLElement $xml 243 * @param SimpleXMLElement $xml 244 * 233 245 * @return Address 234 * @throws BpostInvalidLengthException 235 */ 236 public static function createFromXML(\SimpleXMLElement $xml) 246 * 247 * @throws BpostInvalidLengthException 248 */ 249 public static function createFromXML(SimpleXMLElement $xml) 237 250 { 238 251 $address = new Address(); … … 261 274 262 275 /** 263 * @param \DOMDocument $document276 * @param DOMDocument $document 264 277 * @param $prefix 265 * @param \DOMElement $address266 */ 267 private function streetToXML( \DOMDocument $document, $prefix, \DOMElement $address)278 * @param DOMElement $address 279 */ 280 private function streetToXML(DOMDocument $document, $prefix, DOMElement $address) 268 281 { 269 282 if ($this->getStreetName() !== null) { 270 $tagName = 'streetName'; 271 if ($prefix !== null) { 272 $tagName = $prefix . ':' . $tagName; 273 } 274 $address->appendChild( 275 $document->createElement( 276 $tagName, 283 $address->appendChild( 284 $document->createElement( 285 XmlHelper::getPrefixedTagName('streetName', $prefix), 277 286 $this->getStreetName() 278 287 ) … … 282 291 283 292 /** 284 * @param \DOMDocument $document293 * @param DOMDocument $document 285 294 * @param $prefix 286 * @param \DOMElement $address287 */ 288 private function localityToXML( \DOMDocument $document, $prefix, \DOMElement $address)295 * @param DOMElement $address 296 */ 297 private function localityToXML(DOMDocument $document, $prefix, DOMElement $address) 289 298 { 290 299 if ($this->getPostalCode() !== null) { 291 $tagName = 'postalCode'; 292 if ($prefix !== null) { 293 $tagName = $prefix . ':' . $tagName; 294 } 295 $address->appendChild( 296 $document->createElement( 297 $tagName, 300 $address->appendChild( 301 $document->createElement( 302 XmlHelper::getPrefixedTagName('postalCode', $prefix), 298 303 $this->getPostalCode() 299 304 ) … … 301 306 } 302 307 if ($this->getLocality() !== null) { 303 $tagName = 'locality'; 304 if ($prefix !== null) { 305 $tagName = $prefix . ':' . $tagName; 306 } 307 $address->appendChild( 308 $document->createElement( 309 $tagName, 308 $address->appendChild( 309 $document->createElement( 310 XmlHelper::getPrefixedTagName('locality', $prefix), 310 311 $this->getLocality() 311 312 ) … … 315 316 316 317 /** 317 * @param \DOMDocument $document318 * @param DOMDocument $document 318 319 * @param $prefix 319 * @param \DOMElement $address320 */ 321 private function countryToXML( \DOMDocument $document, $prefix, \DOMElement $address)320 * @param DOMElement $address 321 */ 322 private function countryToXML(DOMDocument $document, $prefix, DOMElement $address) 322 323 { 323 324 if ($this->getCountryCode() !== null) { 324 $tagName = 'countryCode'; 325 if ($prefix !== null) { 326 $tagName = $prefix . ':' . $tagName; 327 } 328 $address->appendChild( 329 $document->createElement( 330 $tagName, 325 $address->appendChild( 326 $document->createElement( 327 XmlHelper::getPrefixedTagName('countryCode', $prefix), 331 328 $this->getCountryCode() 332 329 ) … … 336 333 337 334 /** 338 * @param \DOMDocument $document335 * @param DOMDocument $document 339 336 * @param $prefix 340 * @param \DOMElement $address341 */ 342 private function streetNumbersToXML( \DOMDocument $document, $prefix, \DOMElement $address)337 * @param DOMElement $address 338 */ 339 private function streetNumbersToXML(DOMDocument $document, $prefix, DOMElement $address) 343 340 { 344 341 if ($this->getNumber() !== null) { 345 $tagName = 'number'; 346 if ($prefix !== null) { 347 $tagName = $prefix . ':' . $tagName; 348 } 349 $address->appendChild( 350 $document->createElement( 351 $tagName, 342 $address->appendChild( 343 $document->createElement( 344 XmlHelper::getPrefixedTagName('number', $prefix), 352 345 $this->getNumber() 353 346 ) … … 355 348 } 356 349 if ($this->getBox() !== null) { 357 $tagName = 'box'; 358 if ($prefix !== null) { 359 $tagName = $prefix . ':' . $tagName; 360 } 361 $address->appendChild( 362 $document->createElement( 363 $tagName, 350 $address->appendChild( 351 $document->createElement( 352 XmlHelper::getPrefixedTagName('box', $prefix), 364 353 $this->getBox() 365 354 ) -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 6 7 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 8 use DOMDocument; 9 use DOMElement; 10 use SimpleXMLElement; 7 11 8 12 /** … … 121 125 /** 122 126 * @param string $status 127 * 123 128 * @throws BpostInvalidValueException 124 129 */ … … 162 167 public function setAdditionalCustomerReference($additionalCustomerReference) 163 168 { 164 $this->additionalCustomerReference = (string) $additionalCustomerReference;169 $this->additionalCustomerReference = (string) $additionalCustomerReference; 165 170 } 166 171 … … 195 200 * Return the object as an array for usage in the XML 196 201 * 197 * @param \DomDocument $document 198 * @param string $prefix 199 * @return \DomElement 200 */ 201 public function toXML(\DOMDocument $document, $prefix = null) 202 { 203 $tagName = 'box'; 204 if ($prefix !== null) { 205 $tagName = $prefix . ':' . $tagName; 206 } 207 208 $box = $document->createElement($tagName); 202 * @param DomDocument $document 203 * @param string $prefix 204 * 205 * @return DomElement 206 */ 207 public function toXML(DOMDocument $document, $prefix = null) 208 { 209 $box = $document->createElement(XmlHelper::getPrefixedTagName('box', $prefix)); 209 210 210 211 $this->senderToXML($document, $prefix, $box); … … 218 219 219 220 /** 220 * @param \SimpleXMLElement $xml221 * @param SimpleXMLElement $xml 221 222 * 222 223 * @return Box 224 * 223 225 * @throws BpostInvalidValueException 224 226 * @throws BpostNotImplementedException 225 227 */ 226 public static function createFromXML( \SimpleXMLElement $xml)228 public static function createFromXML(SimpleXMLElement $xml) 227 229 { 228 230 $box = new Box(); … … 237 239 } 238 240 if (isset($xml->nationalBox)) { 239 /** @var \SimpleXMLElement $nationalBoxData */241 /** @var SimpleXMLElement $nationalBoxData */ 240 242 $nationalBoxData = $xml->nationalBox->children('http://schema.post.be/shm/deepintegration/v3/national'); 241 243 … … 246 248 } 247 249 248 if (!method_exists($className, 'createFromXML')) { 249 throw new BpostNotImplementedException('No createFromXML found into ' . $className); 250 } 251 252 $nationalBox = call_user_func( 253 array($className, 'createFromXML'), 254 $nationalBoxData 255 ); 250 XmlHelper::assertMethodCreateFromXmlExists($className); 251 252 $nationalBox = call_user_func(array($className, 'createFromXML'), $nationalBoxData); 256 253 257 254 $box->setNationalBox($nationalBox); 258 255 } 259 256 if (isset($xml->internationalBox)) { 260 /** @var \SimpleXMLElement $internationalBoxData */257 /** @var SimpleXMLElement $internationalBoxData */ 261 258 $internationalBoxData = $xml->internationalBox->children('http://schema.post.be/shm/deepintegration/v3/international'); 262 259 … … 264 261 $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($internationalBoxData->getName()); 265 262 266 if (!method_exists($className, 'createFromXML')) { 267 throw new BpostNotImplementedException('No createFromXML found into ' . $className); 268 } 263 XmlHelper::assertMethodCreateFromXmlExists($className); 269 264 270 265 $internationalBox = call_user_func( … … 279 274 } 280 275 if (isset($xml->additionalCustomerReference) && $xml->additionalCustomerReference != '') { 281 $box->setAdditionalCustomerReference((string) $xml->additionalCustomerReference);276 $box->setAdditionalCustomerReference((string) $xml->additionalCustomerReference); 282 277 } 283 278 if (!empty($xml->barcode)) { … … 292 287 293 288 /** 294 * @param \DOMDocument $document295 * @param $prefix 296 * @param \DOMElement $box297 */ 298 private function barcodeToXML( \DOMDocument $document, $prefix, \DOMElement $box)289 * @param DOMDocument $document 290 * @param $prefix 291 * @param DOMElement $box 292 */ 293 private function barcodeToXML(DOMDocument $document, $prefix, DOMElement $box) 299 294 { 300 295 if ($this->getBarcode() !== null) { 301 $tagName = 'barcode';302 if ($prefix !== null) {303 $tagName = $prefix . ':' . $tagName;304 }305 296 $box->appendChild( 306 297 $document->createElement( 307 $tagName,298 XmlHelper::getPrefixedTagName('barcode', $prefix), 308 299 $this->getBarcode() 309 300 ) … … 313 304 314 305 /** 315 * @param \DOMDocument $document316 * @param $prefix 317 * @param \DOMElement $box318 */ 319 private function boxToXML( \DOMDocument $document, $prefix, \DOMElement $box)306 * @param DOMDocument $document 307 * @param $prefix 308 * @param DOMElement $box 309 */ 310 private function boxToXML(DOMDocument $document, $prefix, DOMElement $box) 320 311 { 321 312 if ($this->getNationalBox() !== null) { … … 332 323 333 324 /** 334 * @param \DOMDocument $document335 * @param $prefix 336 * @param \DOMElement $box337 */ 338 private function senderToXML( \DOMDocument $document, $prefix, \DOMElement $box)325 * @param DOMDocument $document 326 * @param $prefix 327 * @param DOMElement $box 328 */ 329 private function senderToXML(DOMDocument $document, $prefix, DOMElement $box) 339 330 { 340 331 if ($this->getSender() !== null) { … … 346 337 347 338 /** 348 * @param \DOMDocument $document349 * @param $prefix 350 * @param \DOMElement $box351 */ 352 private function remarkToXML( \DOMDocument $document, $prefix, \DOMElement $box)339 * @param DOMDocument $document 340 * @param $prefix 341 * @param DOMElement $box 342 */ 343 private function remarkToXML(DOMDocument $document, $prefix, DOMElement $box) 353 344 { 354 345 if ($this->getRemark() !== null) { 355 $tagName = 'remark';356 if ($prefix !== null) {357 $tagName = $prefix . ':' . $tagName;358 }359 346 $box->appendChild( 360 347 $document->createElement( 361 $tagName,348 XmlHelper::getPrefixedTagName('remark', $prefix), 362 349 $this->getRemark() 363 350 ) … … 367 354 368 355 /** 369 * @param \DOMDocument $document370 * @param $prefix 371 * @param \DOMElement $box372 */ 373 private function additionalCustomerReferenceToXML( \DOMDocument $document, $prefix, \DOMElement $box)356 * @param DOMDocument $document 357 * @param $prefix 358 * @param DOMElement $box 359 */ 360 private function additionalCustomerReferenceToXML(DOMDocument $document, $prefix, DOMElement $box) 374 361 { 375 362 if ($this->getAdditionalCustomerReference() !== null) { 376 $tagName = 'additionalCustomerReference';377 if ($prefix !== null) {378 $tagName = $prefix . ':' . $tagName;379 }380 363 $box->appendChild( 381 364 $document->createElement( 382 $tagName,365 XmlHelper::getPrefixedTagName('additionalCustomerReference', $prefix), 383 366 $this->getAdditionalCustomerReference() 384 367 ) -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/At247.php
r2890340 r3119293 7 7 use Bpost\BpostApiClient\Bpost\Order\ParcelsDepotAddress; 8 8 use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product; 9 use Bpost\BpostApiClient\Common\XmlHelper; 9 10 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 10 11 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 12 use DOMDocument; 13 use DOMElement; 14 use SimpleXMLElement; 11 15 12 16 /** … … 14 18 * 15 19 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 20 * 16 21 * @version 3.0.0 22 * 17 23 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 18 24 * @license BSD License … … 20 26 class At247 extends National 21 27 { 22 /** @var string */28 /** @var string */ 23 29 private $parcelsDepotId; 24 30 … … 134 140 public function setProduct($product) 135 141 { 136 if (! in_array($product, self::getPossibleProductValues())) {142 if (!in_array($product, self::getPossibleProductValues())) { 137 143 throw new BpostInvalidValueException('product', $product, self::getPossibleProductValues()); 138 144 } … … 197 203 public function setRequestedDeliveryDate($requestedDeliveryDate) 198 204 { 199 $this->requestedDeliveryDate = (string) $requestedDeliveryDate;205 $this->requestedDeliveryDate = (string) $requestedDeliveryDate; 200 206 } 201 207 … … 203 209 * Return the object as an array for usage in the XML 204 210 * 205 * @param \DomDocument $document 206 * @param string $prefix 207 * @param string $type 208 * 209 * @return \DomElement 210 */ 211 public function toXML(\DOMDocument $document, $prefix = null, $type = null) 212 { 213 $tagName = 'nationalBox'; 214 if ($prefix !== null) { 215 $tagName = $prefix . ':' . $tagName; 216 } 217 $nationalElement = $document->createElement($tagName); 211 * @param DomDocument $document 212 * @param string $prefix 213 * @param string $type 214 * 215 * @return DomElement 216 */ 217 public function toXML(DOMDocument $document, $prefix = null, $type = null) 218 { 219 $nationalElement = $document->createElement(XmlHelper::getPrefixedTagName('nationalBox', $prefix)); 218 220 $boxElement = parent::toXML($document, null, 'at24-7'); 219 221 $nationalElement->appendChild($boxElement); … … 268 270 269 271 /** 270 * @param \DOMDocument $document271 * @param \DOMElement $typeElement272 * @param string $prefix273 */ 274 protected function addToXmlRequestedDeliveryDate( \DOMDocument $document, \DOMElement $typeElement, $prefix)272 * @param DOMDocument $document 273 * @param DOMElement $typeElement 274 * @param string $prefix 275 */ 276 protected function addToXmlRequestedDeliveryDate(DOMDocument $document, DOMElement $typeElement, $prefix) 275 277 { 276 278 if ($this->getRequestedDeliveryDate() !== null) { 277 279 $typeElement->appendChild( 278 280 $document->createElement( 279 $this->getPrefixedTagName('requestedDeliveryDate', $prefix),281 XmlHelper::getPrefixedTagName('requestedDeliveryDate', $prefix), 280 282 $this->getRequestedDeliveryDate() 281 283 ) … … 285 287 286 288 /** 287 * @param \DOMDocument $document288 * @param \DOMElement $typeElement289 * @param string $prefix290 */ 291 protected function addToXmlUnregistered( \DOMDocument $document, \DOMElement $typeElement, $prefix)289 * @param DOMDocument $document 290 * @param DOMElement $typeElement 291 * @param string $prefix 292 */ 293 protected function addToXmlUnregistered(DOMDocument $document, DOMElement $typeElement, $prefix) 292 294 { 293 295 if ($this->getUnregistered() !== null) { … … 299 301 300 302 /** 301 * @param \SimpleXMLElement $xml302 * @param National|null $self303 * @param SimpleXMLElement $xml 304 * @param National|null $self 303 305 * 304 306 * @return At247 307 * 305 308 * @throws BpostInvalidValueException 306 309 * @throws BpostNotImplementedException … … 308 311 * @throws \Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException 309 312 */ 310 public static function createFromXML( \SimpleXMLElement $xml, National $self = null)313 public static function createFromXML(SimpleXMLElement $xml, National $self = null) 311 314 { 312 315 $at247 = new At247(); … … 314 317 if (isset($xml->{'at24-7'}->product) && $xml->{'at24-7'}->product != '') { 315 318 $at247->setProduct( 316 (string) $xml->{'at24-7'}->product319 (string) $xml->{'at24-7'}->product 317 320 ); 318 321 } 319 322 if (isset($xml->{'at24-7'}->options)) { 320 /** @var \SimpleXMLElement $optionData */323 /** @var SimpleXMLElement $optionData */ 321 324 foreach ($xml->{'at24-7'}->options as $optionData) { 322 325 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); … … 333 336 if (isset($xml->{'at24-7'}->weight) && $xml->{'at24-7'}->weight != '') { 334 337 $at247->setWeight( 335 (int) $xml->{'at24-7'}->weight338 (int) $xml->{'at24-7'}->weight 336 339 ); 337 340 } 338 341 if (isset($xml->{'at24-7'}->memberId) && $xml->{'at24-7'}->memberId != '') { 339 342 $at247->setMemberId( 340 (string) $xml->{'at24-7'}->memberId343 (string) $xml->{'at24-7'}->memberId 341 344 ); 342 345 } 343 346 if (isset($xml->{'at24-7'}->receiverName) && $xml->{'at24-7'}->receiverName != '') { 344 347 $at247->setReceiverName( 345 (string) $xml->{'at24-7'}->receiverName348 (string) $xml->{'at24-7'}->receiverName 346 349 ); 347 350 } 348 351 if (isset($xml->{'at24-7'}->receiverCompany) && $xml->{'at24-7'}->receiverCompany != '') { 349 352 $at247->setReceiverCompany( 350 (string) $xml->{'at24-7'}->receiverCompany353 (string) $xml->{'at24-7'}->receiverCompany 351 354 ); 352 355 } 353 356 if (isset($xml->{'at24-7'}->parcelsDepotId) && $xml->{'at24-7'}->parcelsDepotId != '') { 354 357 $at247->setParcelsDepotId( 355 (string) $xml->{'at24-7'}->parcelsDepotId358 (string) $xml->{'at24-7'}->parcelsDepotId 356 359 ); 357 360 } 358 361 if (isset($xml->{'at24-7'}->parcelsDepotName) && $xml->{'at24-7'}->parcelsDepotName != '') { 359 362 $at247->setParcelsDepotName( 360 (string) $xml->{'at24-7'}->parcelsDepotName363 (string) $xml->{'at24-7'}->parcelsDepotName 361 364 ); 362 365 } 363 366 if (isset($xml->{'at24-7'}->parcelsDepotAddress)) { 364 /** @var \SimpleXMLElement $parcelsDepotAddressData */367 /** @var SimpleXMLElement $parcelsDepotAddressData */ 365 368 $parcelsDepotAddressData = $xml->{'at24-7'}->parcelsDepotAddress->children( 366 369 'http://schema.post.be/shm/deepintegration/v3/common' … … 372 375 if (isset($xml->{'at24-7'}->requestedDeliveryDate) && $xml->{'at24-7'}->requestedDeliveryDate != '') { 373 376 $at247->setRequestedDeliveryDate( 374 (string) $xml->{'at24-7'}->requestedDeliveryDate377 (string) $xml->{'at24-7'}->requestedDeliveryDate 375 378 ); 376 379 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtBpost.php
r2890340 r3119293 7 7 use Bpost\BpostApiClient\Bpost\Order\PugoAddress; 8 8 use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product; 9 use Bpost\BpostApiClient\Common\XmlHelper; 9 10 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 10 11 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 12 use DOMDocument; 13 use DOMElement; 14 use SimpleXMLElement; 11 15 12 16 /** … … 14 18 * 15 19 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 20 * 16 21 * @version 3.0.0 22 * 17 23 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 18 24 * @license BSD License … … 46 52 /** 47 53 * @param string $product Possible values are: bpack@bpost 54 * 48 55 * @throws BpostInvalidValueException 49 56 */ … … 171 178 return $this->shopHandlingInstruction->getValue(); 172 179 } 180 173 181 return null; 174 182 } … … 185 193 * Return the object as an array for usage in the XML 186 194 * 187 * @param \DomDocument $document 188 * @param string $prefix 189 * @param string $type 190 * @return \DomElement 191 */ 192 public function toXML(\DOMDocument $document, $prefix = null, $type = null) 193 { 194 $nationalElement = $document->createElement($this->getPrefixedTagName('nationalBox', $prefix)); 195 * @param DomDocument $document 196 * @param string $prefix 197 * @param string $type 198 * 199 * @return DomElement 200 */ 201 public function toXML(DOMDocument $document, $prefix = null, $type = null) 202 { 203 $nationalElement = $document->createElement(XmlHelper::getPrefixedTagName('nationalBox', $prefix)); 195 204 $boxElement = parent::toXML($document, null, 'atBpost'); 196 205 $nationalElement->appendChild($boxElement); … … 228 237 229 238 /** 230 * @param \DOMDocument $document231 * @param \DOMElement $typeElement232 * @param string $prefix233 */ 234 protected function addToXmlRequestedDeliveryDate( \DOMDocument $document, \DOMElement $typeElement, $prefix)239 * @param DOMDocument $document 240 * @param DOMElement $typeElement 241 * @param string $prefix 242 */ 243 protected function addToXmlRequestedDeliveryDate(DOMDocument $document, DOMElement $typeElement, $prefix) 235 244 { 236 245 if ($this->getRequestedDeliveryDate() !== null) { … … 241 250 } 242 251 243 private function addToXmlShopHandlingInstruction( \DOMDocument $document, \DOMElement $typeElement, $prefix)252 private function addToXmlShopHandlingInstruction(DOMDocument $document, DOMElement $typeElement, $prefix) 244 253 { 245 254 if ($this->getShopHandlingInstruction() !== null) { … … 251 260 252 261 /** 253 * @param \SimpleXMLElement $xml254 * @param National|null $self262 * @param SimpleXMLElement $xml 263 * @param National|null $self 255 264 * 256 265 * @return AtBpost 266 * 257 267 * @throws BpostInvalidValueException 258 268 * @throws BpostNotImplementedException … … 260 270 * @throws \Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException 261 271 */ 262 public static function createFromXML( \SimpleXMLElement $xml, National $self = null)272 public static function createFromXML(SimpleXMLElement $xml, National $self = null) 263 273 { 264 274 $atBpost = new AtBpost(); … … 266 276 if (isset($xml->atBpost->product) && $xml->atBpost->product != '') { 267 277 $atBpost->setProduct( 268 (string) $xml->atBpost->product278 (string) $xml->atBpost->product 269 279 ); 270 280 } 271 281 if (isset($xml->atBpost->options)) { 272 /** @var \SimpleXMLElement $optionData */282 /** @var SimpleXMLElement $optionData */ 273 283 foreach ($xml->atBpost->options as $optionData) { 274 284 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); … … 294 304 if (isset($xml->atBpost->weight) && $xml->atBpost->weight != '') { 295 305 $atBpost->setWeight( 296 (int) $xml->atBpost->weight306 (int) $xml->atBpost->weight 297 307 ); 298 308 } 299 309 if (isset($xml->atBpost->receiverName) && $xml->atBpost->receiverName != '') { 300 310 $atBpost->setReceiverName( 301 (string) $xml->atBpost->receiverName311 (string) $xml->atBpost->receiverName 302 312 ); 303 313 } 304 314 if (isset($xml->atBpost->receiverCompany) && $xml->atBpost->receiverCompany != '') { 305 315 $atBpost->setReceiverCompany( 306 (string) $xml->atBpost->receiverCompany316 (string) $xml->atBpost->receiverCompany 307 317 ); 308 318 } 309 319 if (isset($xml->atBpost->pugoId) && $xml->atBpost->pugoId != '') { 310 320 $atBpost->setPugoId( 311 (string) $xml->atBpost->pugoId321 (string) $xml->atBpost->pugoId 312 322 ); 313 323 } 314 324 if (isset($xml->atBpost->pugoName) && $xml->atBpost->pugoName != '') { 315 325 $atBpost->setPugoName( 316 (string) $xml->atBpost->pugoName326 (string) $xml->atBpost->pugoName 317 327 ); 318 328 } 319 329 if (isset($xml->atBpost->pugoAddress)) { 320 /** @var \SimpleXMLElement $pugoAddressData */330 /** @var SimpleXMLElement $pugoAddressData */ 321 331 $pugoAddressData = $xml->atBpost->pugoAddress->children( 322 332 'http://schema.post.be/shm/deepintegration/v3/common' … … 328 338 if (isset($xml->atBpost->requestedDeliveryDate) && $xml->atBpost->requestedDeliveryDate != '') { 329 339 $atBpost->setRequestedDeliveryDate( 330 (string) $xml->atBpost->requestedDeliveryDate340 (string) $xml->atBpost->requestedDeliveryDate 331 341 ); 332 342 } 333 343 if (isset($xml->atBpost->shopHandlingInstruction) && $xml->atBpost->shopHandlingInstruction != '') { 334 344 $atBpost->setShopHandlingInstruction( 335 (string) $xml->atBpost->shopHandlingInstruction345 (string) $xml->atBpost->shopHandlingInstruction 336 346 ); 337 347 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtHome.php
r2890340 r3119293 5 5 use Bpost\BpostApiClient\Bpost\Order\Receiver; 6 6 use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product; 7 use Bpost\BpostApiClient\Common\XmlHelper; 7 8 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 8 use Bpost\BpostApiClient\Exception\BpostNotImplementedException;9 9 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException; 10 use DOMDocument; 11 use DOMElement; 12 use SimpleXMLElement; 10 13 11 14 /** … … 13 16 * 14 17 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 18 * 15 19 * @version 3.0.0 20 * 16 21 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 17 22 * @license BSD License … … 27 32 /** 28 33 * @param string $product 34 * 29 35 * @see getPossibleProductValues 36 * 30 37 * @throws BpostInvalidValueException 31 38 */ … … 82 89 public function setRequestedDeliveryDate($requestedDeliveryDate) 83 90 { 84 $this->requestedDeliveryDate = (string) $requestedDeliveryDate;91 $this->requestedDeliveryDate = (string) $requestedDeliveryDate; 85 92 } 86 93 … … 88 95 * Return the object as an array for usage in the XML 89 96 * 90 * @param \DomDocument $document 91 * @param string $prefix 92 * @param string $type 93 * @return \DomElement 97 * @param DomDocument $document 98 * @param string $prefix 99 * @param string $type 100 * 101 * @return DomElement 94 102 */ 95 public function toXML( \DOMDocument $document, $prefix = null, $type = null)103 public function toXML(DOMDocument $document, $prefix = null, $type = null) 96 104 { 97 $nationalElement = $document->createElement( $this->getPrefixedTagName('nationalBox', $prefix));105 $nationalElement = $document->createElement(XmlHelper::getPrefixedTagName('nationalBox', $prefix)); 98 106 $boxElement = parent::toXML($document, null, 'atHome'); 99 107 $nationalElement->appendChild($boxElement); … … 111 119 112 120 /** 113 * @param \DOMDocument $document114 * @param \DOMElement $typeElement121 * @param DOMDocument $document 122 * @param DOMElement $typeElement 115 123 */ 116 protected function addToXmlRequestedDeliveryDate( \DOMDocument $document, \DOMElement $typeElement)124 protected function addToXmlRequestedDeliveryDate(DOMDocument $document, DOMElement $typeElement) 117 125 { 118 126 if ($this->getRequestedDeliveryDate() !== null) { … … 127 135 128 136 /** 129 * @param \SimpleXMLElement $xml130 * @param National $self137 * @param SimpleXMLElement $xml 138 * @param National $self 131 139 * 132 140 * @return AtHome 141 * 133 142 * @throws BpostXmlInvalidItemException 134 143 * @throws \Bpost\BpostApiClient\BpostException 135 144 */ 136 public static function createFromXML( \SimpleXMLElement $xml, National $self = null)145 public static function createFromXML(SimpleXMLElement $xml, National $self = null) 137 146 { 138 147 if ($self === null) { -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/BpostOnAppointment.php
r2890340 r3119293 4 4 5 5 use Bpost\BpostApiClient\Bpost\Order\Receiver; 6 use Bpost\BpostApiClient\Common\XmlHelper; 6 7 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException; 8 use DOMDocument; 9 use DOMElement; 10 use SimpleXMLElement; 7 11 8 12 /** 9 13 * Class BpostOnAppointment 10 * @package Bpost\BpostApiClient\Bpost\Order\Box11 14 */ 12 15 class BpostOnAppointment extends National … … 47 50 public function setInNetworkCutOff($inNetworkCutOff) 48 51 { 49 $this->inNetworkCutOff = (string) $inNetworkCutOff;52 $this->inNetworkCutOff = (string) $inNetworkCutOff; 50 53 } 51 54 … … 53 56 * Return the object as an array for usage in the XML 54 57 * 55 * @param \DomDocument $document 56 * @param string $prefix 57 * @param string $type 58 * @return \DomElement 58 * @param DomDocument $document 59 * @param string $prefix 60 * @param string $type 61 * 62 * @return DomElement 59 63 */ 60 public function toXML( \DOMDocument $document, $prefix = null, $type = null)64 public function toXML(DOMDocument $document, $prefix = null, $type = null) 61 65 { 62 $nationalElement = $document->createElement( $this->getPrefixedTagName('nationalBox', $prefix));66 $nationalElement = $document->createElement(XmlHelper::getPrefixedTagName('nationalBox', $prefix)); 63 67 $boxElement = parent::toXML($document, null, 'bpostOnAppointment'); 64 68 $nationalElement->appendChild($boxElement); … … 72 76 73 77 /** 74 * @param \DOMDocument $document75 * @param \DOMElement $typeElement78 * @param DOMDocument $document 79 * @param DOMElement $typeElement 76 80 */ 77 protected function addToXmlReceiver( \DOMDocument $document, \DOMElement $typeElement)81 protected function addToXmlReceiver(DOMDocument $document, DOMElement $typeElement) 78 82 { 79 83 if ($this->getReceiver() !== null) { … … 85 89 86 90 /** 87 * @param \DOMDocument $document88 * @param \DOMElement $typeElement89 * @param string $prefix91 * @param DOMDocument $document 92 * @param DOMElement $typeElement 93 * @param string $prefix 90 94 */ 91 protected function addToXmlRequestedDeliveryDate( \DOMDocument $document, \DOMElement $typeElement, $prefix)95 protected function addToXmlRequestedDeliveryDate(DOMDocument $document, DOMElement $typeElement, $prefix) 92 96 { 93 97 if ($this->getInNetworkCutOff() !== null) { 94 98 $typeElement->appendChild( 95 99 $document->createElement( 96 $this->getPrefixedTagName('inNetworkCutOff', $prefix),100 XmlHelper::getPrefixedTagName('inNetworkCutOff', $prefix), 97 101 $this->getInNetworkCutOff() 98 102 ) … … 102 106 103 107 /** 104 * @param \SimpleXMLElement $xml 105 * @param National|null $self 108 * @param SimpleXMLElement $xml 109 * @param National|null $self 110 * 106 111 * @return BpostOnAppointment 112 * 107 113 * @throws BpostXmlInvalidItemException 108 114 */ 109 public static function createFromXML( \SimpleXMLElement $xml, National $self = null)115 public static function createFromXML(SimpleXMLElement $xml, National $self = null) 110 116 { 111 117 $self = new self(); … … 127 133 if (isset($bpostOnAppointmentXml->inNetworkCutOff) && $bpostOnAppointmentXml->inNetworkCutOff != '') { 128 134 $self->setInNetworkCutOff( 129 (string) $bpostOnAppointmentXml->inNetworkCutOff135 (string) $bpostOnAppointmentXml->inNetworkCutOff 130 136 ); 131 137 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/CustomsInfo/CustomsInfo.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; 6 7 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 8 use DOMDocument; 9 use DOMElement; 10 use DOMException; 11 use SimpleXMLElement; 7 12 8 13 /** … … 10 15 * 11 16 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 17 * 12 18 * @version 3.0.0 19 * 13 20 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 14 21 * @license BSD License … … 26 33 const CUSTOM_INFO_SHIPMENT_TYPE_OTHER = 'OTHER'; 27 34 35 const CUSTOM_INFO_CURRENCY_EUR = 'EUR'; 36 const CUSTOM_INFO_CURRENCY_GBP = 'GBP'; 37 const CUSTOM_INFO_CURRENCY_USD = 'USD'; 38 const CUSTOM_INFO_CURRENCY_CNY = 'CNY'; 39 28 40 /** 29 41 * @var int … … 52 64 53 65 /** 66 * this is the currency used for field parcelValue.In case of shipment to non-European country, 67 * this is also the currency used for all parcel contents value (field valueOfitem) in 3 letters format. 68 * 69 * Possible values are: EUR=Euro GBP=Pound Sterling USD=US Dollar CNY=Yuan Renminbi 70 * 71 * @var string 72 */ 73 private $currency; 74 75 /** 76 * Amount paid by the sender for the sending of this shipment. See contract pricing with bpost. 77 * Decimal format field (3.2) 78 * Minimum value : 0 79 * Maximum value : 999.99 80 * Currency for field amtPostagePaidByAddresse is always EUR ! 81 * 82 * @var float 83 */ 84 private $amtPostagePaidByAddresse; 85 86 /** 54 87 * @param string $contentDescription 88 * 55 89 * @throws BpostInvalidLengthException 56 90 */ … … 75 109 /** 76 110 * @param string $parcelReturnInstructions 111 * 77 112 * @throws BpostInvalidValueException 78 113 */ … … 129 164 130 165 /** 131 * @param bool ean$privateAddress166 * @param bool $privateAddress 132 167 */ 133 168 public function setPrivateAddress($privateAddress) … … 137 172 138 173 /** 139 * @return bool ean174 * @return bool 140 175 */ 141 176 public function getPrivateAddress() … … 146 181 /** 147 182 * @param string $shipmentType 183 * 148 184 * @throws BpostInvalidValueException 149 185 */ … … 182 218 183 219 /** 220 * @return float 221 */ 222 public function getAmtPostagePaidByAddresse() 223 { 224 return $this->amtPostagePaidByAddresse; 225 } 226 227 /** 228 * @param float $amtPostagePaidByAddresse 229 */ 230 public function setAmtPostagePaidByAddresse($amtPostagePaidByAddresse) 231 { 232 $this->amtPostagePaidByAddresse = $amtPostagePaidByAddresse; 233 } 234 235 /** 236 * @return string 237 */ 238 public function getCurrency() 239 { 240 return $this->currency; 241 } 242 243 /** 244 * @param string $currency 245 * 246 * @throws BpostInvalidValueException 247 */ 248 public function setCurrency($currency) 249 { 250 if (!in_array($currency, self::getPossibleCurrencyValues())) { 251 throw new BpostInvalidValueException('currency', $currency, self::getPossibleCurrencyValues()); 252 } 253 $this->currency = $currency; 254 } 255 256 public static function getPossibleCurrencyValues() 257 { 258 return array( 259 self::CUSTOM_INFO_CURRENCY_EUR, 260 self::CUSTOM_INFO_CURRENCY_GBP, 261 self::CUSTOM_INFO_CURRENCY_USD, 262 self::CUSTOM_INFO_CURRENCY_CNY, 263 ); 264 } 265 266 /** 184 267 * Return the object as an array for usage in the XML 185 268 * 186 * @param \DomDocument $document 187 * @param string $prefix 188 * @return \DomElement 189 */ 190 public function toXML(\DOMDocument $document, $prefix = null) 191 { 192 $tagName = 'customsInfo'; 193 if ($prefix !== null) { 194 $tagName = $prefix . ':' . $tagName; 195 } 196 197 $customsInfo = $document->createElement($tagName); 269 * @param DomDocument $document 270 * @param string $prefix 271 * 272 * @return DomElement 273 * 274 * @throws DOMException 275 */ 276 public function toXML(DOMDocument $document, $prefix = null) 277 { 278 $customsInfo = $document->createElement(XmlHelper::getPrefixedTagName('customsInfo', $prefix)); 198 279 199 280 $this->parcelValueToXML($document, $prefix, $customsInfo); 200 281 $this->contentDescriptionToXML($document, $prefix, $customsInfo); 201 282 $this->shipmentTypeToXML($document, $prefix, $customsInfo); 202 $this->p ossibleParcelReturnInstructionValuesToXML($document, $prefix, $customsInfo);283 $this->parcelReturnInstructionValuesToXML($document, $prefix, $customsInfo); 203 284 $this->privateAddressToXML($document, $prefix, $customsInfo); 285 $this->currencyToXML($document, $prefix, $customsInfo); 286 $this->amtPostagePaidByAddresseToXML($document, $prefix, $customsInfo); 204 287 205 288 return $customsInfo; … … 207 290 208 291 /** 209 * @param \SimpleXMLElement $xml292 * @param SimpleXMLElement $xml 210 293 * 211 294 * @return CustomsInfo 295 * 212 296 * @throws BpostInvalidLengthException 213 297 * @throws BpostInvalidValueException 214 298 */ 215 public static function createFromXML( \SimpleXMLElement $xml)299 public static function createFromXML(SimpleXMLElement $xml) 216 300 { 217 301 $customsInfo = new CustomsInfo(); … … 239 323 if (isset($xml->privateAddress) && $xml->privateAddress != '') { 240 324 $customsInfo->setPrivateAddress( 241 ((string) $xml->privateAddress == 'true') 325 (string) $xml->privateAddress == 'true' 326 ); 327 } 328 if (isset($xml->currency) && $xml->currency != '') { 329 $customsInfo->setCurrency( 330 (string) $xml->currency 331 ); 332 } 333 if (isset($xml->amtPostagePaidByAddresse) && $xml->amtPostagePaidByAddresse != '') { 334 $customsInfo->setAmtPostagePaidByAddresse( 335 (float) $xml->amtPostagePaidByAddresse 242 336 ); 243 337 } … … 247 341 248 342 /** 249 * @param \DOMDocument $document 250 * @param $prefix 251 * @param \DOMElement $customsInfo 252 */ 253 private function parcelValueToXML(\DOMDocument $document, $prefix, \DOMElement $customsInfo) 343 * @param DOMDocument $document 344 * @param string $prefix 345 * @param DOMElement $customsInfo 346 * 347 * @throws DOMException 348 */ 349 private function parcelValueToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 254 350 { 255 351 if ($this->getParcelValue() !== null) { 256 $tagName = 'parcelValue'; 257 if ($prefix !== null) { 258 $tagName = $prefix . ':' . $tagName; 259 } 260 $customsInfo->appendChild( 261 $document->createElement( 262 $tagName, 352 $customsInfo->appendChild( 353 $document->createElement( 354 XmlHelper::getPrefixedTagName('parcelValue', $prefix), 263 355 $this->getParcelValue() 264 356 ) … … 268 360 269 361 /** 270 * @param \DOMDocument $document 271 * @param $prefix 272 * @param \DOMElement $customsInfo 273 */ 274 private function contentDescriptionToXML(\DOMDocument $document, $prefix, \DOMElement $customsInfo) 362 * @param DOMDocument $document 363 * @param string $prefix 364 * @param DOMElement $customsInfo 365 * 366 * @throws DOMException 367 */ 368 private function currencyToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 369 { 370 if ($this->getCurrency() !== null) { 371 $customsInfo->appendChild( 372 $document->createElement( 373 XmlHelper::getPrefixedTagName('currency', $prefix), 374 $this->getCurrency() 375 ) 376 ); 377 } 378 } 379 380 /** 381 * @param DOMDocument $document 382 * @param string $prefix 383 * @param DOMElement $customsInfo 384 * 385 * @throws DOMException 386 */ 387 private function amtPostagePaidByAddresseToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 388 { 389 if ($this->getAmtPostagePaidByAddresse() !== null) { 390 $customsInfo->appendChild( 391 $document->createElement( 392 XmlHelper::getPrefixedTagName('amtPostagePaidByAddresse', $prefix), 393 sprintf('%0.2f', $this->getAmtPostagePaidByAddresse()) 394 ) 395 ); 396 } 397 } 398 399 /** 400 * @param DOMDocument $document 401 * @param string $prefix 402 * @param DOMElement $customsInfo 403 * 404 * @throws DOMException 405 */ 406 private function contentDescriptionToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 275 407 { 276 408 if ($this->getContentDescription() !== null) { 277 $tagName = 'contentDescription'; 278 if ($prefix !== null) { 279 $tagName = $prefix . ':' . $tagName; 280 } 281 $customsInfo->appendChild( 282 $document->createElement( 283 $tagName, 409 $customsInfo->appendChild( 410 $document->createElement( 411 XmlHelper::getPrefixedTagName('contentDescription', $prefix), 284 412 $this->getContentDescription() 285 413 ) … … 289 417 290 418 /** 291 * @param \DOMDocument $document 292 * @param $prefix 293 * @param \DOMElement $customsInfo 294 */ 295 private function shipmentTypeToXML(\DOMDocument $document, $prefix, \DOMElement $customsInfo) 419 * @param DOMDocument $document 420 * @param string $prefix 421 * @param DOMElement $customsInfo 422 * 423 * @throws DOMException 424 */ 425 private function shipmentTypeToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 296 426 { 297 427 if ($this->getShipmentType() !== null) { 298 $tagName = 'shipmentType'; 299 if ($prefix !== null) { 300 $tagName = $prefix . ':' . $tagName; 301 } 302 $customsInfo->appendChild( 303 $document->createElement( 304 $tagName, 428 $customsInfo->appendChild( 429 $document->createElement( 430 XmlHelper::getPrefixedTagName('shipmentType', $prefix), 305 431 $this->getShipmentType() 306 432 ) … … 310 436 311 437 /** 312 * @param \DOMDocument $document 313 * @param $prefix 314 * @param \DOMElement $customsInfo 315 */ 316 private function possibleParcelReturnInstructionValuesToXML(\DOMDocument $document, $prefix, \DOMElement $customsInfo) 317 { 318 if ($this->getPossibleParcelReturnInstructionValues() !== null) { 319 $tagName = 'parcelReturnInstructions'; 320 if ($prefix !== null) { 321 $tagName = $prefix . ':' . $tagName; 322 } 323 $customsInfo->appendChild( 324 $document->createElement( 325 $tagName, 438 * @param DOMDocument $document 439 * @param string $prefix 440 * @param DOMElement $customsInfo 441 * 442 * @throws DOMException 443 */ 444 private function parcelReturnInstructionValuesToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 445 { 446 if ($this->getParcelReturnInstructions() !== null) { 447 $customsInfo->appendChild( 448 $document->createElement( 449 XmlHelper::getPrefixedTagName('parcelReturnInstructions', $prefix), 326 450 $this->getParcelReturnInstructions() 327 451 ) … … 331 455 332 456 /** 333 * @param \DOMDocument $document 334 * @param $prefix 335 * @param \DOMElement $customsInfo 336 */ 337 private function privateAddressToXML(\DOMDocument $document, $prefix, \DOMElement $customsInfo) 457 * @param DOMDocument $document 458 * @param string $prefix 459 * @param DOMElement $customsInfo 460 * 461 * @throws DOMException 462 */ 463 private function privateAddressToXML(DOMDocument $document, $prefix, DOMElement $customsInfo) 338 464 { 339 465 if ($this->getPrivateAddress() !== null) { 340 $tagName = 'privateAddress';341 if ($prefix !== null) {342 $tagName = $prefix . ':' . $tagName;343 }344 466 if ($this->getPrivateAddress()) { 345 467 $value = 'true'; … … 349 471 $customsInfo->appendChild( 350 472 $document->createElement( 351 $tagName,473 XmlHelper::getPrefixedTagName('privateAddress', $prefix), 352 474 $value 353 475 ) -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/IBox.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box; 4 4 5 use DomDocument; 6 use DomElement; 7 use SimpleXMLElement; 8 5 9 /** 6 10 * Interface IBox 7 * @package Bpost\BpostApiClient\Bpost\Order\Box8 11 */ 9 12 interface IBox … … 36 39 /** 37 40 * @remark should be implemented by the child class 41 * 38 42 * @return array 39 43 */ … … 42 46 /** 43 47 * Return the object as an array for usage in the XML 44 * @param \DomDocument $document 45 * @param string $prefix 46 * @return \DomElement 48 * 49 * @param DomDocument $document 50 * @param string $prefix 51 * 52 * @return DomElement 47 53 */ 48 public function toXML( \DOMDocument $document, $prefix = null);54 public function toXML(DOMDocument $document, $prefix = null); 49 55 50 56 /** 51 * @param \SimpleXMLElement $xml 57 * @param SimpleXMLElement $xml 58 * 52 59 * @return self 53 60 */ 54 public static function createFromXML( \SimpleXMLElement $xml);61 public static function createFromXML(SimpleXMLElement $xml); 55 62 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/International.php
r2890340 r3119293 4 4 5 5 use Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo; 6 use Bpost\BpostApiClient\Bpost\Order\Box\International\ParcelContent; 6 7 use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging; 7 8 use Bpost\BpostApiClient\Bpost\Order\Box\Option\Option; 8 9 use Bpost\BpostApiClient\Bpost\Order\Receiver; 9 10 use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product; 11 use Bpost\BpostApiClient\Common\XmlHelper; 12 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; 10 13 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 11 14 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 15 use DomDocument; 16 use DomElement; 17 use DOMException; 18 use SimpleXMLElement; 12 19 13 20 /** … … 15 22 * 16 23 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 24 * 17 25 * @version 3.0.0 26 * 18 27 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 19 28 * @license BSD License … … 24 33 * @var string 25 34 */ 26 pr ivate$product;35 protected $product; 27 36 28 37 /** 29 38 * @var array 30 39 */ 31 private $options ;32 33 /** 34 * @var \Bpost\BpostApiClient\Bpost\Order\Receiver40 private $options = array(); 41 42 /** 43 * @var Receiver 35 44 */ 36 45 private $receiver; … … 42 51 43 52 /** 44 * @var \Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo53 * @var CustomsInfo 45 54 */ 46 55 private $customsInfo; 47 56 48 57 /** 49 * @param \Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo $customsInfo 58 * Only for shipments outside Europe. 59 * Might include from 1 to 10 “parcelContent”. 60 * 61 * @var array|ParcelContent[] 62 */ 63 private $parcelContents = array(); 64 65 /** 66 * @param CustomsInfo $customsInfo 50 67 */ 51 68 public function setCustomsInfo($customsInfo) … … 55 72 56 73 /** 57 * @return \Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo74 * @return CustomsInfo 58 75 */ 59 76 public function getCustomsInfo() … … 104 121 /** 105 122 * @param string $product 123 * 106 124 * @throws BpostInvalidValueException 107 125 */ … … 133 151 Product::PRODUCT_NAME_BPACK_WORLD_EXPRESS_PRO, 134 152 Product::PRODUCT_NAME_BPACK_EUROPE_BUSINESS, 153 Product::PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL, 135 154 ); 136 155 } 137 156 138 157 /** 139 * @param \Bpost\BpostApiClient\Bpost\Order\Receiver $receiver158 * @param Receiver $receiver 140 159 */ 141 160 public function setReceiver($receiver) … … 145 164 146 165 /** 147 * @return \Bpost\BpostApiClient\Bpost\Order\Receiver166 * @return Receiver 148 167 */ 149 168 public function getReceiver() … … 153 172 154 173 /** 174 * @return array|ParcelContent[] 175 */ 176 public function getParcelContents() 177 { 178 return $this->parcelContents; 179 } 180 181 /** 182 * @param array|ParcelContent[] $parcelContents 183 * 184 * @return self 185 * 186 * @throws BpostInvalidValueException 187 */ 188 public function setParcelContents(array $parcelContents) 189 { 190 foreach ($parcelContents as $parcelContent) { 191 if (!$parcelContent instanceof ParcelContent) { 192 throw new BpostInvalidValueException( 193 'parcelContents', 194 get_class($parcelContent), 195 array('Bpost\BpostApiClient\Bpost\Order\Box\International\ParcelContent') 196 ); 197 } 198 199 $this->addParcelContent($parcelContent); 200 } 201 202 return $this; 203 } 204 205 public function addParcelContent(ParcelContent $parcelContent) 206 { 207 $this->parcelContents[] = $parcelContent; 208 } 209 210 /** 155 211 * Return the object as an array for usage in the XML 156 212 * 157 * @param \DomDocument $document 158 * @param string $prefix 159 * @return \DomElement 160 */ 161 public function toXML(\DOMDocument $document, $prefix = null) 162 { 163 $tagName = 'internationalBox'; 164 if ($prefix !== null) { 165 $tagName = $prefix . ':' . $tagName; 166 } 167 168 $internationalBox = $document->createElement($tagName); 169 $international = $document->createElement('international:international'); 213 * @param DomDocument $document 214 * @param string $prefix 215 * 216 * @return DOMElement 217 * 218 * @throws DOMException 219 */ 220 public function toXML(DOMDocument $document, $prefix = null) 221 { 222 $internationalBox = $document->createElement(XmlHelper::getPrefixedTagName('internationalBox', $prefix)); 223 $prefix = 'international'; 224 $international = $document->createElement(XmlHelper::getPrefixedTagName('international', $prefix)); 170 225 $internationalBox->appendChild($international); 171 226 172 227 if ($this->getProduct() !== null) { 173 228 $international->appendChild( 174 $document->createElement( 175 'international:product', 176 $this->getProduct() 177 ) 229 $document->createElement(XmlHelper::getPrefixedTagName('product', $prefix), $this->getProduct()) 178 230 ); 179 231 } … … 181 233 $options = $this->getOptions(); 182 234 if (!empty($options)) { 183 $optionsElement = $document->createElement( 'international:options');235 $optionsElement = $document->createElement(XmlHelper::getPrefixedTagName('options', $prefix)); 184 236 foreach ($options as $option) { 185 237 $optionsElement->appendChild( 186 $option->toXML($document )238 $option->toXML($document, 'common') 187 239 ); 188 240 } … … 192 244 if ($this->getReceiver() !== null) { 193 245 $international->appendChild( 194 $this->getReceiver()->toXML($document, 'international')246 $this->getReceiver()->toXML($document, $prefix) 195 247 ); 196 248 } … … 199 251 $international->appendChild( 200 252 $document->createElement( 201 'international:parcelWeight',253 XmlHelper::getPrefixedTagName('parcelWeight', $prefix), 202 254 $this->getParcelWeight() 203 255 ) … … 207 259 if ($this->getCustomsInfo() !== null) { 208 260 $international->appendChild( 209 $this->getCustomsInfo()->toXML($document, 'international') 210 ); 261 $this->getCustomsInfo()->toXML($document, $prefix) 262 ); 263 } 264 265 if ($this->getParcelContents()) { 266 $parcelContents = $document->createElement(XmlHelper::getPrefixedTagName('parcelContents', $prefix)); 267 foreach ($this->getParcelContents() as $parcelContent) { 268 $parcelContents->appendChild( 269 $parcelContent->toXML($document, $prefix) 270 ); 271 } 272 $international->appendChild($parcelContents); 211 273 } 212 274 … … 215 277 216 278 /** 217 * @param \SimpleXMLElement $xml279 * @param SimpleXMLElement $xml 218 280 * 219 281 * @return International 282 * 283 * @throws BpostInvalidLengthException 220 284 * @throws BpostInvalidValueException 221 285 * @throws BpostNotImplementedException 222 286 */ 223 public static function createFromXML( \SimpleXMLElement $xml)287 public static function createFromXML(SimpleXMLElement $xml) 224 288 { 225 289 $international = new International(); … … 231 295 } 232 296 if (isset($xml->international->options)) { 233 /** @var \SimpleXMLElement $optionData */ 234 foreach ($xml->international->options as $optionData) { 235 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); 236 237 if (in_array($optionData->getName(), array(Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED))) { 238 $option = Messaging::createFromXML($optionData); 239 } else { 240 $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName()); 241 if (!method_exists($className, 'createFromXML')) { 242 throw new BpostNotImplementedException('No createFromXML found into ' . $className); 243 } 244 $option = call_user_func( 245 array($className, 'createFromXML'), 246 $optionData 247 ); 297 /** @var SimpleXMLElement $optionData */ 298 $options = $xml->international->options->children('http://schema.post.be/shm/deepintegration/v3/common'); 299 foreach ($options as $optionData) { 300 switch ($optionData->getName()) { 301 case Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED: 302 case Messaging::MESSAGING_TYPE_KEEP_ME_INFORMED: 303 case Messaging::MESSAGING_TYPE_INFO_REMINDER: 304 case Messaging::MESSAGING_TYPE_INFO_NEXT_DAY: 305 $option = Messaging::createFromXML($optionData); 306 break; 307 default: 308 $className = '\Bpost\BpostApiClient\Bpost\Order\Box\Option\\' . ucfirst($optionData->getName()); 309 XmlHelper::assertMethodCreateFromXmlExists($className); 310 $option = call_user_func( 311 array($className, 'createFromXML'), 312 $optionData 313 ); 248 314 } 249 315 … … 269 335 ); 270 336 } 337 if (isset($xml->international->parcelContents)) { 338 /** @var SimpleXMLElement $optionData */ 339 $parcelContents = $xml->international->parcelContents->children('international', true); 340 foreach ($parcelContents as $parcelContentXml) { 341 $parcelContent = ParcelContent::createFromXML($parcelContentXml); 342 $international->addParcelContent($parcelContent); 343 } 344 } 271 345 272 346 return $international; -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National.php
r2890340 r3119293 8 8 use Bpost\BpostApiClient\BpostException; 9 9 use Bpost\BpostApiClient\Common\ComplexAttribute; 10 use Bpost\BpostApiClient\Common\XmlHelper; 11 use Bpost\BpostApiClient\Exception\BpostNotImplementedException; 10 12 use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException; 13 use DomDocument; 14 use DomElement; 15 use SimpleXMLElement; 11 16 12 17 /** … … 14 19 * 15 20 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 21 * 16 22 * @version 3.0.0 23 * 17 24 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 18 25 * @license BSD License … … 77 84 /** 78 85 * @remark should be implemented by the child class 86 * 79 87 * @return array 80 88 */ … … 143 151 * Return the object as an array for usage in the XML 144 152 * 145 * @param \DomDocument $document 146 * @param string $prefix 147 * @param string $type 148 * @return \DomElement 149 */ 150 public function toXML(\DOMDocument $document, $prefix = null, $type = null) 153 * @param DomDocument $document 154 * @param string $prefix 155 * @param string $type 156 * 157 * @return DomElement 158 */ 159 public function toXML(DOMDocument $document, $prefix = null, $type = null) 151 160 { 152 161 $typeElement = $document->createElement($type); 153 162 154 163 if ($this->getProduct() !== null) { 155 $tagName = 'product';156 if ($prefix !== null) {157 $tagName = $prefix . ':' . $tagName;158 }159 164 $typeElement->appendChild( 160 165 $document->createElement( 161 $tagName,166 XmlHelper::getPrefixedTagName('product', $prefix), 162 167 $this->getProduct() 163 168 ) … … 178 183 if ($this->getWeight() !== null) { 179 184 $typeElement->appendChild( 180 $document->createElement( $this->getPrefixedTagName('weight', $prefix), $this->getWeight())185 $document->createElement(XmlHelper::getPrefixedTagName('weight', $prefix), $this->getWeight()) 181 186 ); 182 187 } … … 197 202 $typeElement->appendChild( 198 203 $document->createElement( 199 $this->getPrefixedTagName('desiredDeliveryPlace', $prefix),204 XmlHelper::getPrefixedTagName('desiredDeliveryPlace', $prefix), 200 205 $this->getDesiredDeliveryPlace() 201 206 ) … … 206 211 } 207 212 208 209 /**210 * @param \SimpleXMLElement $nationalXml211 * @param National $self213 /** 214 * @param SimpleXMLElement $nationalXml 215 * @param National $self 216 * 212 217 * @return AtHome 218 * 213 219 * @throws BpostException 214 220 * @throws BpostXmlInvalidItemException 215 221 */ 216 public static function createFromXML( \SimpleXMLElement $nationalXml, National $self = null)222 public static function createFromXML(SimpleXMLElement $nationalXml, National $self = null) 217 223 { 218 224 if ($self === null) { … … 222 228 if (isset($nationalXml->product) && $nationalXml->product != '') { 223 229 $self->setProduct( 224 (string) $nationalXml->product230 (string) $nationalXml->product 225 231 ); 226 232 } 227 233 228 234 if (isset($nationalXml->options) && !empty($nationalXml->options)) { 229 /** @var \SimpleXMLElement $optionData */235 /** @var SimpleXMLElement $optionData */ 230 236 foreach ($nationalXml->options as $optionData) { 231 237 $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common'); … … 249 255 if (isset($nationalXml->weight) && $nationalXml->weight != '') { 250 256 $self->setWeight( 251 (int) $nationalXml->weight257 (int) $nationalXml->weight 252 258 ); 253 259 } … … 255 261 if (isset($nationalXml->openingHours) && $nationalXml->openingHours != '') { 256 262 foreach ($nationalXml->openingHours->children() as $day => $value) { 257 $self->addOpeningHour(new Day($day, (string) $value));263 $self->addOpeningHour(new Day($day, (string) $value)); 258 264 } 259 265 } … … 261 267 if (isset($nationalXml->desiredDeliveryPlace) && $nationalXml->desiredDeliveryPlace != '') { 262 268 $self->setDesiredDeliveryPlace( 263 (string) $nationalXml->desiredDeliveryPlace269 (string) $nationalXml->desiredDeliveryPlace 264 270 ); 265 271 } … … 269 275 270 276 /** 271 * @param \SimpleXMLElement $optionData277 * @param SimpleXMLElement $optionData 272 278 * 273 279 * @return Option 274 * @throws BpostXmlInvalidItemException 275 */ 276 protected static function getOptionFromOptionData(\SimpleXMLElement $optionData) 277 { 278 switch ($optionData->getName()) { 279 case 'insured': 280 $class = 'Insurance'; 281 break; 282 default: 283 $class = ucfirst($optionData->getName()); 284 } 285 $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\'.$class; 286 if (!method_exists($className, 'createFromXML')) { 287 throw new BpostXmlInvalidItemException(); 288 } 280 * 281 * @throws BpostNotImplementedException 282 */ 283 protected static function getOptionFromOptionData(SimpleXMLElement $optionData) 284 { 285 $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\Option\\' . ucfirst($optionData->getName()); 286 XmlHelper::assertMethodCreateFromXmlExists($className); 289 287 290 288 return call_user_func( -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National/ParcelLockerReducedMobilityZone.php
r2890340 r3119293 4 4 5 5 use Bpost\BpostApiClient\Common\ComplexAttribute; 6 use Bpost\BpostApiClient\Common\XmlHelper; 7 use DOMDocument; 8 use DOMElement; 9 use SimpleXMLElement; 6 10 7 11 class ParcelLockerReducedMobilityZone extends ComplexAttribute 8 12 { 9 13 /** 10 * @param \DOMDocument $document 11 * @param string $prefix 12 * @param string $type 13 * @return \DOMElement 14 * @param DOMDocument $document 15 * @param string $prefix 16 * @param string $type 17 * 18 * @return DOMElement 14 19 */ 15 public function toXml( \DOMDocument $document, $prefix = null, $type = null)20 public function toXml(DOMDocument $document, $prefix = null, $type = null) 16 21 { 17 $tagName = $this->getPrefixedTagName('parcelLockerReducedMobilityZone', $prefix);22 $tagName = XmlHelper::getPrefixedTagName('parcelLockerReducedMobilityZone', $prefix); 18 23 19 24 $xml = $document->createElement($tagName); … … 24 29 /** 25 30 * @todo Implement it, because today, nothing is specified 26 * @param \SimpleXMLElement $xml 31 * 32 * @param SimpleXMLElement $xml 33 * 27 34 * @return ParcelLockerReducedMobilityZone|ComplexAttribute 28 35 */ 29 public static function createFromXml( \SimpleXMLElement $xml)36 public static function createFromXml(SimpleXMLElement $xml) 30 37 { 31 38 $self = new self(); 39 32 40 return $self; 33 41 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National/Unregistered.php
r2890340 r3119293 7 7 use Bpost\BpostApiClient\Common\BasicAttribute\PhoneNumber; 8 8 use Bpost\BpostApiClient\Common\ComplexAttribute; 9 use Bpost\BpostApiClient\Common\XmlHelper; 10 use DOMDocument; 11 use DOMElement; 12 use SimpleXMLElement; 9 13 10 14 class Unregistered extends ComplexAttribute … … 119 123 120 124 /** 121 * @param \DOMDocument $document 122 * @param string $prefix 123 * @param string $type 124 * @return \DOMElement 125 * @param DOMDocument $document 126 * @param string $prefix 127 * @param string $type 128 * 129 * @return DOMElement 125 130 */ 126 public function toXml( \DOMDocument $document, $prefix = null, $type = null)131 public function toXml(DOMDocument $document, $prefix = null, $type = null) 127 132 { 128 $tagName = $this->getPrefixedTagName('unregistered', $prefix);133 $tagName = XmlHelper::getPrefixedTagName('unregistered', $prefix); 129 134 130 135 $xml = $document->createElement($tagName); 131 136 132 137 if ($this->hasLanguage()) { 133 $tagName = $this->getPrefixedTagName('language', $prefix);138 $tagName = XmlHelper::getPrefixedTagName('language', $prefix); 134 139 $xml->appendChild($document->createElement($tagName, $this->getLanguage())); 135 140 } 136 141 137 142 if ($this->getMobilePhone() !== null) { 138 $tagName = $this->getPrefixedTagName('mobilePhone', $prefix);143 $tagName = XmlHelper::getPrefixedTagName('mobilePhone', $prefix); 139 144 $xml->appendChild($document->createElement($tagName, $this->getMobilePhone())); 140 145 } 141 146 142 147 if ($this->getEmailAddress() !== null) { 143 $tagName = $this->getPrefixedTagName('emailAddress', $prefix);148 $tagName = XmlHelper::getPrefixedTagName('emailAddress', $prefix); 144 149 $xml->appendChild($document->createElement($tagName, $this->getEmailAddress())); 145 150 } … … 155 160 156 161 /** 157 * @param \SimpleXMLElement $xml 162 * @param SimpleXMLElement $xml 163 * 158 164 * @return Unregistered 159 165 */ 160 public static function createFromXml( \SimpleXMLElement $xml)166 public static function createFromXml(SimpleXMLElement $xml) 161 167 { 162 168 $self = new self(); 163 169 164 170 if (isset($xml->language) && $xml->language != '') { 165 $self->setLanguage((string) $xml->language);171 $self->setLanguage((string) $xml->language); 166 172 } 167 173 168 174 if (isset($xml->mobilePhone) && $xml->mobilePhone != '') { 169 $self->setMobilePhone((string) $xml->mobilePhone);175 $self->setMobilePhone((string) $xml->mobilePhone); 170 176 } 171 177 172 178 if (isset($xml->emailAddress) && $xml->emailAddress != '') { 173 $self->setEmailAddress((string) $xml->emailAddress);179 $self->setEmailAddress((string) $xml->emailAddress); 174 180 } 175 181 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/OpeningHour/Day.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\OpeningHour; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 7 use DomDocument; 8 use DomElement; 6 9 7 10 /** … … 9 12 * 10 13 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 14 * 11 15 * @version 3.0.0 16 * 12 17 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 13 18 * @license BSD License … … 35 40 /** 36 41 * @param string $day 42 * 37 43 * @throws BpostInvalidValueException 38 44 */ … … 101 107 * Return the object as an array for usage in the XML 102 108 * 103 * @param \DomDocument $document 104 * @param string $prefix 105 * @return \DomElement 109 * @param DomDocument $document 110 * @param string $prefix 111 * 112 * @return DomElement 106 113 */ 107 public function toXML( \DOMDocument $document, $prefix = null)114 public function toXML(DOMDocument $document, $prefix = null) 108 115 { 109 $tagName = $this->getDay(); 110 if ($prefix !== null) { 111 $tagName = $prefix . ':' . $tagName; 112 } 113 114 return $document->createElement($tagName, $this->getValue()); 116 return $document->createElement( 117 XmlHelper::getPrefixedTagName($this->getDay(), $prefix), 118 $this->getValue() 119 ); 115 120 } 116 121 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/AutomaticSecondPresentation.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 6 use DomDocument; 7 use DomElement; 8 use SimpleXMLElement; 4 9 5 10 /** … … 7 12 * 8 13 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 14 * 9 15 * @version 3.0.0 16 * 10 17 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 11 18 * @license BSD License … … 16 23 * Return the object as an array for usage in the XML 17 24 * 18 * @param \DomDocument $document 19 * @param string $prefix 20 * @return \DomElement 25 * @param DomDocument $document 26 * @param string $prefix 27 * 28 * @return DomElement 21 29 */ 22 public function toXML( \DOMDocument $document, $prefix = null)30 public function toXML(DOMDocument $document, $prefix = 'common') 23 31 { 24 $tagName = 'automaticSecondPresentation'; 25 if ($prefix !== null) { 26 $tagName = $prefix . ':' . $tagName; 27 } 28 29 return $document->createElement($tagName); 32 return $document->createElement(XmlHelper::getPrefixedTagName('automaticSecondPresentation', $prefix)); 30 33 } 31 34 32 35 /** 33 * @param \SimpleXMLElement $xml36 * @param SimpleXMLElement $xml 34 37 * 35 38 * @return static 36 39 */ 37 public static function createFromXML( \SimpleXMLElement $xml)40 public static function createFromXML(SimpleXMLElement $xml) 38 41 { 39 42 return new static(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/CashOnDelivery.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 6 use DomDocument; 7 use DomElement; 4 8 5 9 /** … … 7 11 * 8 12 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 13 * 9 14 * @version 3.0.0 15 * 10 16 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 11 17 * @license BSD License … … 91 97 * Return the object as an array for usage in the XML 92 98 * 93 * @param \DomDocument $document 94 * @param string $prefix 95 * @return \DomElement 99 * @param DomDocument $document 100 * @param string $prefix 101 * 102 * @return DomElement 96 103 */ 97 public function toXML( \DOMDocument $document, $prefix = 'common')104 public function toXML(DOMDocument $document, $prefix = 'common') 98 105 { 99 $tagName = 'cod'; 100 if ($prefix !== null) { 101 $tagName = $prefix . ':' . $tagName; 102 } 103 104 $cod = $document->createElement($tagName); 106 $cod = $document->createElement(XmlHelper::getPrefixedTagName('cod', $prefix)); 105 107 106 108 if ($this->getAmount() !== null) { 107 $tagName = 'codAmount';108 if ($prefix !== null) {109 $tagName = $prefix . ':' . $tagName;110 }111 109 $cod->appendChild( 112 110 $document->createElement( 113 $tagName,111 XmlHelper::getPrefixedTagName('codAmount', $prefix), 114 112 $this->getAmount() 115 113 ) … … 117 115 } 118 116 if ($this->getIban() !== null) { 119 $tagName = 'iban';120 if ($prefix !== null) {121 $tagName = $prefix . ':' . $tagName;122 }123 117 $cod->appendChild( 124 118 $document->createElement( 125 $tagName,119 XmlHelper::getPrefixedTagName('iban', $prefix), 126 120 $this->getIban() 127 121 ) … … 129 123 } 130 124 if ($this->getBic() !== null) { 131 $tagName = 'bic';132 if ($prefix !== null) {133 $tagName = $prefix . ':' . $tagName;134 }135 125 $cod->appendChild( 136 126 $document->createElement( 137 $tagName,127 XmlHelper::getPrefixedTagName('bic', $prefix), 138 128 $this->getBic() 139 129 ) -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Insurance.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; 4 4 5 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;6 7 5 /** 8 * bPost Insurance class 9 * 10 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 11 * @version 3.0.0 12 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 13 * @license BSD License 6 * @deprecated 7 * @see Insured 14 8 */ 15 class Insurance extends Option9 class Insurance extends Insured 16 10 { 17 const INSURANCE_TYPE_BASIC_INSURANCE = 'basicInsurance';18 const INSURANCE_TYPE_ADDITIONAL_INSURANCE = 'additionalInsurance';19 20 const INSURANCE_AMOUNT_UP_TO_2500_EUROS = 2;21 const INSURANCE_AMOUNT_UP_TO_5000_EUROS = 3;22 const INSURANCE_AMOUNT_UP_TO_7500_EUROS = 4;23 const INSURANCE_AMOUNT_UP_TO_10000_EUROS = 5;24 const INSURANCE_AMOUNT_UP_TO_12500_EUROS = 6;25 const INSURANCE_AMOUNT_UP_TO_15000_EUROS = 7;26 const INSURANCE_AMOUNT_UP_TO_17500_EUROS = 8;27 const INSURANCE_AMOUNT_UP_TO_20000_EUROS = 9;28 const INSURANCE_AMOUNT_UP_TO_22500_EUROS = 10;29 const INSURANCE_AMOUNT_UP_TO_25000_EUROS = 11;30 31 /**32 * @var string33 */34 private $type;35 36 /**37 * @var string38 */39 private $value;40 41 /**42 * @return array43 */44 public static function getPossibleTypeValues()45 {46 return array(47 self::INSURANCE_TYPE_BASIC_INSURANCE,48 self::INSURANCE_TYPE_ADDITIONAL_INSURANCE,49 );50 }51 52 /**53 * @param string $type54 * @throws BpostInvalidValueException55 */56 public function setType($type)57 {58 if (!in_array($type, self::getPossibleTypeValues())) {59 throw new BpostInvalidValueException('type', $type, self::getPossibleTypeValues());60 }61 62 $this->type = $type;63 }64 65 /**66 * @return string67 */68 public function getType()69 {70 return $this->type;71 }72 73 /**74 * @param string $value75 * @throws BpostInvalidValueException76 */77 public function setValue($value)78 {79 if (!in_array($value, self::getPossibleValueValues())) {80 throw new BpostInvalidValueException('value', $value, self::getPossibleValueValues());81 }82 83 $this->value = $value;84 }85 86 /**87 * @return string88 */89 public function getValue()90 {91 return $this->value;92 }93 94 /**95 * @return array96 */97 public static function getPossibleValueValues()98 {99 return array(100 self::INSURANCE_AMOUNT_UP_TO_2500_EUROS,101 self::INSURANCE_AMOUNT_UP_TO_5000_EUROS,102 self::INSURANCE_AMOUNT_UP_TO_7500_EUROS,103 self::INSURANCE_AMOUNT_UP_TO_10000_EUROS,104 self::INSURANCE_AMOUNT_UP_TO_12500_EUROS,105 self::INSURANCE_AMOUNT_UP_TO_15000_EUROS,106 self::INSURANCE_AMOUNT_UP_TO_17500_EUROS,107 self::INSURANCE_AMOUNT_UP_TO_20000_EUROS,108 self::INSURANCE_AMOUNT_UP_TO_22500_EUROS,109 self::INSURANCE_AMOUNT_UP_TO_25000_EUROS,110 );111 }112 113 /**114 * @param string $type115 * @param string|null $value116 *117 * @throws BpostInvalidValueException118 */119 public function __construct($type, $value = null)120 {121 $this->setType($type);122 if ($value !== null) {123 $this->setValue($value);124 }125 }126 127 /**128 * Return the object as an array for usage in the XML129 *130 * @param \DomDocument $document131 * @param string $prefix132 * @return \DomElement133 */134 public function toXML(\DOMDocument $document, $prefix = 'common')135 {136 $tagName = 'insured';137 if ($prefix !== null) {138 $tagName = $prefix . ':' . $tagName;139 }140 $insured = $document->createElement($tagName);141 142 $tagName = $this->getType();143 if ($prefix !== null) {144 $tagName = $prefix . ':' . $tagName;145 }146 $insurance = $document->createElement($tagName);147 $insured->appendChild($insurance);148 149 if ($this->getValue() !== null) {150 $insurance->setAttribute('value', $this->getValue());151 }152 153 return $insured;154 }155 156 /**157 * @param \SimpleXMLElement $xml158 *159 * @return static160 */161 public static function createFromXML(\SimpleXMLElement $xml)162 {163 $data = $xml->{$xml->getName()}[0];164 165 $type = '';166 $value = 0;167 if (isset($data->{static::INSURANCE_TYPE_BASIC_INSURANCE})) {168 $type = static::INSURANCE_TYPE_BASIC_INSURANCE;169 $value = (int)$data->{static::INSURANCE_TYPE_BASIC_INSURANCE}->attributes()->value;170 } elseif (isset($data->{static::INSURANCE_TYPE_ADDITIONAL_INSURANCE})) {171 $value = (int)$data->{static::INSURANCE_TYPE_ADDITIONAL_INSURANCE}->attributes()->value;172 if ($value == 1) {173 $type = static::INSURANCE_TYPE_BASIC_INSURANCE;174 $value = null;175 } else {176 $type = static::INSURANCE_TYPE_ADDITIONAL_INSURANCE;177 }178 }179 180 return new static($type, $value);181 }182 11 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Messaging.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; 6 7 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException; 8 use DomDocument; 9 use DomElement; 10 use SimpleXMLElement; 7 11 8 12 /** … … 10 14 * 11 15 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 16 * 12 17 * @version 3.0.0 18 * 13 19 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 14 20 * @license BSD License … … 48 54 /** 49 55 * @param string $emailAddress 56 * 50 57 * @throws BpostInvalidLengthException 51 58 */ … … 70 77 /** 71 78 * @param string $language 79 * 72 80 * @throws BpostInvalidValueException 73 81 */ … … 106 114 /** 107 115 * @param string $mobilePhone 116 * 108 117 * @throws BpostInvalidLengthException 109 118 */ … … 141 150 /** 142 151 * @param string $type 152 * 143 153 * @throws BpostInvalidValueException 144 154 */ … … 161 171 162 172 /** 163 * @param string $type164 * @param string $language173 * @param string $type 174 * @param string $language 165 175 * @param string|null $emailAddress 166 176 * @param string|null $mobilePhone … … 185 195 * Return the object as an array for usage in the XML 186 196 * 187 * @param \DomDocument $document 188 * @param string $prefix 189 * @return \DomElement 190 */ 191 public function toXML(\DOMDocument $document, $prefix = 'common') 192 { 193 $tagName = $this->getType(); 194 if ($prefix !== null) { 195 $tagName = $prefix . ':' . $tagName; 196 } 197 198 $messaging = $document->createElement($tagName); 197 * @param DomDocument $document 198 * @param string $prefix 199 * 200 * @return DomElement 201 */ 202 public function toXML(DOMDocument $document, $prefix = 'common') 203 { 204 $messaging = $document->createElement(XmlHelper::getPrefixedTagName($this->getType(), $prefix)); 199 205 $messaging->setAttribute('language', $this->getLanguage()); 200 206 201 207 if ($this->getEmailAddress() !== null) { 202 $tagName = 'emailAddress';203 if ($prefix !== null) {204 $tagName = $prefix . ':' . $tagName;205 }206 208 $messaging->appendChild( 207 209 $document->createElement( 208 $tagName,210 XmlHelper::getPrefixedTagName('emailAddress', $prefix), 209 211 $this->getEmailAddress() 210 212 ) … … 212 214 } 213 215 if ($this->getMobilePhone() !== null) { 214 $tagName = 'mobilePhone';215 if ($prefix !== null) {216 $tagName = $prefix . ':' . $tagName;217 }218 216 $messaging->appendChild( 219 217 $document->createElement( 220 $tagName,218 XmlHelper::getPrefixedTagName('mobilePhone', $prefix), 221 219 $this->getMobilePhone() 222 220 ) … … 228 226 229 227 /** 230 * @param \SimpleXMLElement $xml228 * @param SimpleXMLElement $xml 231 229 * 232 230 * @return Messaging 233 * @throws BpostInvalidLengthException 234 */ 235 public static function createFromXML(\SimpleXMLElement $xml) 231 * 232 * @throws BpostInvalidLengthException 233 * @throws BpostInvalidValueException 234 */ 235 public static function createFromXML(SimpleXMLElement $xml) 236 236 { 237 237 $messaging = new Messaging($xml->getName(), (string) $xml->attributes()->language); 238 238 239 $ data = $xml->{$xml->getName()};240 if ( isset($data->emailAddress) && $data->emailAddress != '') {241 $messaging->setEmailAddress((string) $ data->emailAddress);242 } 243 if ( isset($data->mobilePhone) && $data->mobilePhone != '') {244 $messaging->setMobilePhone((string) $ data->mobilePhone);239 $children = $xml->children('http://schema.post.be/shm/deepintegration/v3/common'); 240 if ((string) $children->emailAddress !== '') { 241 $messaging->setEmailAddress((string) $children->emailAddress); 242 } 243 if ((string) $children->mobilePhone !== '') { 244 $messaging->setMobilePhone((string) $children->mobilePhone); 245 245 } 246 246 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Option.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; 4 5 use DOMDocument; 6 use DOMElement; 4 7 5 8 /** … … 7 10 * 8 11 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 12 * 9 13 * @version 3.0.0 14 * 10 15 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 11 16 * @license BSD License … … 14 19 { 15 20 /** 16 * @param \DOMDocument $document 17 * @param string $prefix 18 * @return \DOMElement 21 * @param DOMDocument $document 22 * @param string $prefix 23 * 24 * @return DOMElement 19 25 */ 20 abstract public function toXML( \DOMDocument $document, $prefix = null);26 abstract public function toXML(DOMDocument $document, $prefix = null); 21 27 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/SaturdayDelivery.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order\Box\Option; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use DOMDocument; 6 7 use DomElement; … … 10 11 * 11 12 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 13 * 12 14 * @version 3.0.0 15 * 13 16 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 14 17 * @license BSD License … … 19 22 * Return the object as an array for usage in the XML 20 23 * 21 * @param DomDocument $document 22 * @param string $prefix 24 * @param DomDocument $document 25 * @param string $prefix 26 * 23 27 * @return DomElement 24 28 */ 25 29 public function toXML(DOMDocument $document, $prefix = 'common') 26 30 { 27 $tagName = 'saturdayDelivery'; 28 if ($prefix !== null) { 29 $tagName = $prefix . ':' . $tagName; 30 } 31 32 return $document->createElement($tagName); 31 return $document->createElement(XmlHelper::getPrefixedTagName('saturdayDelivery', $prefix)); 33 32 } 34 33 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Signature.php
r2890340 r3119293 4 4 5 5 /** 6 * bPost Signature class 7 * 8 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 9 * @version 3.0.0 10 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 11 * @license BSD License 6 * @deprecated 7 * @see Signed 12 8 */ 13 class Signature extends Option9 class Signature extends Signed 14 10 { 15 /**16 * Return the object as an array for usage in the XML17 *18 * @param \DomDocument $document19 * @param string $prefix20 * @return \DomElement21 */22 public function toXML(\DOMDocument $document, $prefix = null)23 {24 $tagName = 'signed';25 if ($prefix !== null) {26 $tagName = $prefix . ':' . $tagName;27 }28 29 return $document->createElement($tagName);30 }31 11 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Customer.php
r2890340 r3119293 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 5 6 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; 7 use DomDocument; 8 use DomElement; 9 use SimpleXMLElement; 6 10 7 11 /** … … 73 77 /** 74 78 * @param string $emailAddress 79 * 75 80 * @throws BpostInvalidLengthException 76 81 */ … … 110 115 /** 111 116 * @param string $phoneNumber 117 * 112 118 * @throws BpostInvalidLengthException 113 119 */ … … 132 138 * Return the object as an array for usage in the XML 133 139 * 134 * @param \DomDocument $document 135 * @param string $prefix 136 * @return \DomElement 137 */ 138 public function toXML(\DomDocument $document, $prefix = null) 139 { 140 $tagName = static::TAG_NAME; 141 if ($prefix !== null) { 142 $tagName = $prefix . ':' . $tagName; 143 } 144 145 $customer = $document->createElement($tagName); 140 * @param DomDocument $document 141 * @param string $prefix 142 * 143 * @return DomElement 144 */ 145 public function toXML(DOMDocument $document, $prefix = null) 146 { 147 $customer = $document->createElement(XmlHelper::getPrefixedTagName(static::TAG_NAME, $prefix)); 146 148 147 149 if ($this->getName() !== null) { … … 187 189 188 190 /** 189 * @param \SimpleXMLElement $xml190 * @param Customer$instance191 * @param SimpleXMLElement $xml 192 * @param Customer $instance 191 193 * 192 194 * @return Customer 195 * 193 196 * @throws BpostInvalidLengthException 194 197 */ 195 public static function createFromXMLHelper( \SimpleXMLElement $xml, Customer $instance)198 public static function createFromXMLHelper(SimpleXMLElement $xml, Customer $instance) 196 199 { 197 200 if (isset($xml->name) && $xml->name != '') { -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Line.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 5 use Bpost\BpostApiClient\Common\XmlHelper; 6 use DomDocument; 7 use DOMElement; 8 use SimpleXMLElement; 4 9 5 10 /** … … 69 74 * Return the object as an array for usage in the XML 70 75 * 71 * @param \DomDocument $document 72 * @param string $prefix 73 * @return \DOMElement 76 * @param DomDocument $document 77 * @param string $prefix 78 * 79 * @return DOMElement 74 80 */ 75 public function toXML( \DomDocument $document, $prefix = null)81 public function toXML(DOMDocument $document, $prefix = null) 76 82 { 77 $tagName = 'orderLine'; 78 if ($prefix !== null) { 79 $tagName = $prefix . ':' . $tagName; 80 } 81 82 $line = $document->createElement($tagName); 83 $line = $document->createElement(XmlHelper::getPrefixedTagName('orderLine', $prefix)); 83 84 84 85 if ($this->getText() !== null) { 85 $tagName = 'text';86 if ($prefix !== null) {87 $tagName = $prefix . ':' . $tagName;88 }89 86 $line->appendChild( 90 87 $document->createElement( 91 $tagName,88 XmlHelper::getPrefixedTagName('text', $prefix), 92 89 $this->getText() 93 90 ) … … 95 92 } 96 93 if ($this->getNumberOfItems() !== null) { 97 $tagName = 'nbOfItems';98 if ($prefix !== null) {99 $tagName = $prefix . ':' . $tagName;100 }101 94 $line->appendChild( 102 95 $document->createElement( 103 $tagName,96 XmlHelper::getPrefixedTagName('nbOfItems', $prefix), 104 97 $this->getNumberOfItems() 105 98 ) … … 111 104 112 105 /** 113 * @param \SimpleXMLElement $xml 106 * @param SimpleXMLElement $xml 107 * 114 108 * @return Line 115 109 */ 116 public static function createFromXML( \SimpleXMLElement $xml)110 public static function createFromXML(SimpleXMLElement $xml) 117 111 { 118 112 $line = new Line(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/ParcelsDepotAddress.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 5 use SimpleXMLElement; 4 6 5 7 /** … … 13 15 14 16 /** 15 * @param \SimpleXMLElement $xml 17 * @param SimpleXMLElement $xml 18 * 16 19 * @return ParcelsDepotAddress 17 20 */ 18 public static function createFromXML( \SimpleXMLElement $xml)21 public static function createFromXML(SimpleXMLElement $xml) 19 22 { 20 23 return parent::createFromXML($xml); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/PugoAddress.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 5 use SimpleXMLElement; 4 6 5 7 /** … … 13 15 14 16 /** 15 * @param \SimpleXMLElement $xml 17 * @param SimpleXMLElement $xml 18 * 16 19 * @return PugoAddress 17 20 */ 18 public static function createFromXML( \SimpleXMLElement $xml)21 public static function createFromXML(SimpleXMLElement $xml) 19 22 { 20 23 return parent::createFromXML($xml); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Receiver.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 5 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException; 6 use SimpleXMLElement; 4 7 5 8 /** … … 13 16 14 17 /** 15 * @param \SimpleXMLElement $xml 18 * @param SimpleXMLElement $xml 19 * 16 20 * @return Receiver 21 * 22 * @throws BpostInvalidLengthException 17 23 */ 18 public static function createFromXML( \SimpleXMLElement $xml)24 public static function createFromXML(SimpleXMLElement $xml) 19 25 { 20 $receiver = new Receiver();21 $receiver = parent::createFromXMLHelper($xml, $receiver);26 /** @var Receiver $receiver */ 27 $receiver = parent::createFromXMLHelper($xml, new Receiver()); 22 28 23 29 return $receiver; -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Sender.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Bpost\Order; 4 5 use SimpleXMLElement; 4 6 5 7 /** … … 13 15 14 16 /** 15 * @param \SimpleXMLElement $xml 17 * @param SimpleXMLElement $xml 18 * 16 19 * @return Sender 17 20 */ 18 public static function createFromXML( \SimpleXMLElement $xml)21 public static function createFromXML(SimpleXMLElement $xml) 19 22 { 20 $sender = new Sender();21 $sender = parent::createFromXMLHelper($xml, $sender);23 /** @var Sender $sender */ 24 $sender = parent::createFromXMLHelper($xml, new Sender()); 22 25 23 26 return $sender; -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration.php
r2890340 r3119293 8 8 /** 9 9 * Class ProductConfiguration 10 * @package Bpost\BpostApiClient\Bpost11 10 */ 12 11 class ProductConfiguration -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Characteristic.php
r2890340 r3119293 7 7 /** 8 8 * Class Characteristic 9 * @package Bpost\BpostApiClient\Bpost\ProductConfiguration10 9 */ 11 10 class Characteristic 12 11 { 13 /** @var string */12 /** @var string */ 14 13 private $displayValue; 15 /** @var int */14 /** @var int */ 16 15 private $value; 17 /** @var string */16 /** @var string */ 18 17 private $name; 19 18 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/DeliveryMethod.php
r2890340 r3119293 7 7 /** 8 8 * Class DeliveryMethod 9 * @package Bpost\BpostApiClient\Bpost\ProductConfiguration10 9 */ 11 10 class DeliveryMethod … … 20 19 const DELIVERY_METHOD_VISIBILITY_INVISIBLE = 'INVISIBLE'; 21 20 22 /** @var string */21 /** @var string */ 23 22 private $name; 24 /** @var string */23 /** @var string */ 25 24 private $visibility; 26 25 /** @var Product[] */ … … 66 65 public function setName($name) 67 66 { 68 $this->name = (string) $name;67 $this->name = (string) $name; 69 68 } 70 69 71 70 /** 72 71 * @return string 72 * 73 73 * @see Constants self::VISIBLITY_* 74 74 */ … … 93 93 public function setVisibility($visibility) 94 94 { 95 $this->visibility = (string) $visibility;95 $this->visibility = (string) $visibility; 96 96 } 97 97 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Option.php
r2890340 r3119293 7 7 /** 8 8 * Class Option 9 * @package Bpost\BpostApiClient\Bpost\ProductConfiguration10 9 */ 11 10 class Option … … 15 14 const OPTION_VISIBILITY_VISIBLE_BY_CONSUMER_AND_MANDATORY = 'VISIBLE_BY_CONSUMER_AND_MANDATORY'; 16 15 17 /** @var string */16 /** @var string */ 18 17 private $visibility; 19 /** @var int */18 /** @var int */ 20 19 private $price; 21 /** @var string */20 /** @var string */ 22 21 private $name; 23 22 /** @var Characteristic[] */ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Price.php
r2890340 r3119293 8 8 /** 9 9 * Class Price 10 * @package Bpost\BpostApiClient\Bpost\ProductConfiguration11 10 */ 12 11 class Price 13 12 { 14 /** @var string */13 /** @var string */ 15 14 private $countryIso2; 16 15 17 /** @var int */16 /** @var int */ 18 17 private $priceLessThan2; 19 /** @var int */18 /** @var int */ 20 19 private $price2To5; 21 /** @var int */20 /** @var int */ 22 21 private $price5To10; 23 /** @var int */22 /** @var int */ 24 23 private $price10To20; 25 /** @var int */24 /** @var int */ 26 25 private $price20To30; 27 26 … … 53 52 * 54 53 * @return int 54 * 55 55 * @throws BpostInvalidWeightException 56 56 */ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Product.php
r1467688 r3119293 7 7 /** 8 8 * Class Product 9 * @package Bpost\BpostApiClient\Bpost\ProductConfiguration10 9 */ 11 10 class Product … … 23 22 const PRODUCT_NAME_BPACK_WORLD_BUSINESS = 'bpack World Business'; 24 23 const PRODUCT_NAME_BPACK_EUROPE_BUSINESS = 'bpack Europe Business'; 24 const PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL = 'bpack@bpost international'; 25 25 26 /** @var bool */26 /** @var bool */ 27 27 private $default; 28 /** @var string */28 /** @var string */ 29 29 private $name; 30 30 31 /** @var Price[] */31 /** @var Price[] */ 32 32 private $prices = array(); 33 /** @var Option[] */33 /** @var Option[] */ 34 34 private $options = array(); 35 35 … … 66 66 } 67 67 } 68 68 69 return $product; 69 70 } … … 151 152 case self::PRODUCT_NAME_BPACK_WORLD_BUSINESS: 152 153 case self::PRODUCT_NAME_BPACK_EUROPE_BUSINESS: 154 case self::PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL: 153 155 default: 154 156 return false; -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Visibility.php
r1467688 r3119293 5 5 /** 6 6 * Class Visibility 7 * @package Bpost\BpostApiClient\Bpost\ProductConfiguration8 7 */ 9 8 class Visibility -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/BpostException.php
r2890340 r3119293 2 2 3 3 namespace Bpost\BpostApiClient; 4 5 use Exception; 4 6 5 7 /** … … 8 10 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 9 11 */ 10 class BpostException extends \Exception12 class BpostException extends Exception 11 13 { 12 14 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/BasicAttribute.php
r2890340 r3119293 18 18 /** 19 19 * BasicAttribute constructor. 20 * 20 21 * @param mixed $value 21 22 * @param string $key … … 41 42 private function setKey($key) 42 43 { 43 $this->key = (string) ($key ?: $this->getDefaultKey());44 $this->key = (string) ($key ?: $this->getDefaultKey()); 44 45 } 45 46 … … 57 58 public function __toString() 58 59 { 59 return (string)$this->getValue(); 60 } 61 62 /** 63 * Prefix $tagName with the $prefix, if needed 64 * @param string $prefix 65 * @param string $tagName 66 * @return string 67 */ 68 public function getPrefixedTagName($tagName, $prefix = null) 69 { 70 if (empty($prefix)) { 71 return $tagName; 72 } 73 return $prefix . ':' . $tagName; 60 return (string) $this->getValue(); 74 61 } 75 62 76 63 /** 77 64 * @param int $length 65 * 78 66 * @throws BpostInvalidLengthException 79 67 */ … … 87 75 /** 88 76 * @param array $allowedValues 77 * 89 78 * @throws BpostInvalidValueException 90 79 */ … … 98 87 /** 99 88 * @param string $regexPattern 89 * 100 90 * @throws BpostInvalidPatternException 101 91 */ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/ComplexAttribute.php
r1467688 r3119293 5 5 abstract class ComplexAttribute 6 6 { 7 /**8 * Prefix $tagName with the $prefix, if needed9 * @param string $prefix10 * @param string $tagName11 * @return string12 */13 public function getPrefixedTagName($tagName, $prefix = null)14 {15 if (empty($prefix)) {16 return $tagName;17 }18 return $prefix . ':' . $tagName;19 }20 7 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/IAttribute.php
r2021946 r3119293 3 3 namespace Bpost\BpostApiClient\Common; 4 4 5 use DOMDocument; 6 use DOMElement; 7 use SimpleXMLElement; 8 5 9 interface IAttribute 6 10 { 7 11 /** 8 * @param \DOMDocument $document 9 * @param string $prefix 10 * @param string $type 11 * @return \DOMElement 12 * @param DOMDocument $document 13 * @param string $prefix 14 * @param string $type 15 * 16 * @return DOMElement 12 17 */ 13 public function toXml( \DOMDocument $document, $prefix = null, $type = null);18 public function toXml(DOMDocument $document, $prefix = null, $type = null); 14 19 15 20 /** 16 * @param \SimpleXMLElement $xml 21 * @param SimpleXMLElement $xml 22 * 17 23 * @return IAttribute 18 24 */ 19 public static function createFromXml( \SimpleXMLElement $xml);25 public static function createFromXml(SimpleXMLElement $xml); 20 26 } -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/ValidatedValue.php
r2890340 r3119293 18 18 /** 19 19 * ValidatedValue constructor. 20 * 20 21 * @param mixed $value 21 22 */ … … 47 48 public function __toString() 48 49 { 49 return (string) $this->getValue();50 return (string) $this->getValue(); 50 51 } 51 52 52 53 /** 53 54 * @param int $length 55 * 54 56 * @throws BpostInvalidLengthException 55 57 */ … … 63 65 /** 64 66 * @param array $allowedValues 67 * 65 68 * @throws BpostInvalidValueException 66 69 */ … … 74 77 /** 75 78 * @param string $regexPattern 79 * 76 80 * @throws BpostInvalidPatternException 77 81 */ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostApiResponseException 9 * @package Bpost\BpostApiClient\Exception10 9 */ 11 10 class BpostApiResponseException extends BpostException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostApiBusinessException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostApiBusinessException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 9 */ 11 10 class BpostApiBusinessException extends BpostApiResponseException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostApiSystemException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostApiSystemException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 9 */ 11 10 class BpostApiSystemException extends BpostApiResponseException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostCurlException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostCurlException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 9 */ 11 10 class BpostCurlException extends BpostApiResponseException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidResponseException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostApiResponseException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostInvalidResponseException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 10 */ 11 11 class BpostInvalidResponseException extends BpostApiResponseException 12 12 { 13 13 /** 14 * @param string $message15 * @param int $code16 * @param \Exception $previous14 * @param string $message 15 * @param int $code 16 * @param Exception $previous 17 17 */ 18 public function __construct($message = "", $code = 0, \Exception $previous = null)18 public function __construct($message = '', $code = 0, Exception $previous = null) 19 19 { 20 20 $message = 'Invalid response' . (empty($message) ? '' : ': ' . $message); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidSelectionException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostInvalidSelectionException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 9 */ 11 10 class BpostInvalidSelectionException extends BpostApiResponseException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidXmlResponseException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostApiResponseException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostInvalidXmlResponseException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 10 */ 11 11 class BpostInvalidXmlResponseException extends BpostApiResponseException 12 12 { 13 13 /** 14 * @param string $message15 * @param int $code16 * @param \Exception $previous14 * @param string $message 15 * @param int $code 16 * @param Exception $previous 17 17 */ 18 public function __construct($message = "", $code = 0, \Exception $previous = null)18 public function __construct($message = '', $code = 0, Exception $previous = null) 19 19 { 20 20 $message = 'Invalid XML-response' . (empty($message) ? '' : ': ' . $message); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostTaxipostLocatorException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostTaxipostLocatorException 9 * @package Bpost\BpostApiClient\Exception\BpostApiResponseException10 9 */ 11 10 class BpostTaxipostLocatorException extends BpostApiResponseException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostLogicException 9 * @package Bpost\BpostApiClient\Exception10 9 */ 11 10 class BpostLogicException extends BpostException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidDayException.php
r2021946 r3119293 3 3 namespace Bpost\BpostApiClient\Exception\BpostLogicException; 4 4 5 use Exception; 6 5 7 /** 6 8 * Class BpostInvalidDayException 7 * @package Bpost\BpostApiClient\Exception\LogicException8 9 */ 9 10 class BpostInvalidDayException extends BpostInvalidValueException 10 11 { 11 12 /** 12 * @param string $invalidValue13 * @param array $allowedValues14 * @param int $code15 * @param \Exception $previous13 * @param string $invalidValue 14 * @param array $allowedValues 15 * @param int $code 16 * @param Exception $previous 16 17 */ 17 public function __construct($invalidValue, array $allowedValues, $code = 0, \Exception $previous = null)18 public function __construct($invalidValue, array $allowedValues, $code = 0, Exception $previous = null) 18 19 { 19 20 parent::__construct('day', $invalidValue, $allowedValues, $code, $previous); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidLengthException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostLogicException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostInvalidLengthException 9 * @package Bpost\BpostApiClient\Exception\LogicException10 10 */ 11 11 class BpostInvalidLengthException extends BpostLogicException … … 13 13 /** 14 14 * BpostInvalidLengthException constructor. 15 * @param string $nameEntry 16 * @param int $invalidLength 17 * @param int $maximumLength 18 * @param int $code 19 * @param \Exception $previous 15 * 16 * @param string $nameEntry 17 * @param int $invalidLength 18 * @param int $maximumLength 19 * @param int $code 20 * @param Exception $previous 20 21 */ 21 public function __construct($nameEntry, $invalidLength, $maximumLength, $code = 0, \Exception $previous = null)22 public function __construct($nameEntry, $invalidLength, $maximumLength, $code = 0, Exception $previous = null) 22 23 { 23 24 $message = sprintf( -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidPatternException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostLogicException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostInvalidValueException 9 * @package Bpost\BpostApiClient\Exception\LogicException10 10 */ 11 11 class BpostInvalidPatternException extends BpostLogicException 12 12 { 13 13 /** 14 * @param string $key15 * @param string $invalidValue16 * @param string $regexPattern17 * @param int $code18 * @param \Exception $previous14 * @param string $key 15 * @param string $invalidValue 16 * @param string $regexPattern 17 * @param int $code 18 * @param Exception $previous 19 19 */ 20 public function __construct($key, $invalidValue, $regexPattern, $code = 0, \Exception $previous = null)20 public function __construct($key, $invalidValue, $regexPattern, $code = 0, Exception $previous = null) 21 21 { 22 22 $message = sprintf( -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidValueException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostLogicException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostInvalidValueException 9 * @package Bpost\BpostApiClient\Exception\LogicException10 10 */ 11 11 class BpostInvalidValueException extends BpostLogicException 12 12 { 13 13 /** 14 * @param string $key15 * @param string $invalidValue16 * @param array $allowedValues17 * @param int $code18 * @param \Exception $previous14 * @param string $key 15 * @param string $invalidValue 16 * @param array $allowedValues 17 * @param int $code 18 * @param Exception $previous 19 19 */ 20 public function __construct($key, $invalidValue, array $allowedValues, $code = 0, \Exception $previous = null)20 public function __construct($key, $invalidValue, array $allowedValues, $code = 0, Exception $previous = null) 21 21 { 22 22 $message = sprintf( -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidWeightException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostLogicException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostInvalidWeightException 9 * @package Bpost\BpostApiClient\Exception\LogicException10 10 */ 11 11 class BpostInvalidWeightException extends BpostLogicException 12 12 { 13 13 /** 14 * @param string $invalidWeight15 * @param int $maximumWeight16 * @param int $code17 * @param \Exception $previous14 * @param string $invalidWeight 15 * @param int $maximumWeight 16 * @param int $code 17 * @param Exception $previous 18 18 */ 19 public function __construct($invalidWeight, $maximumWeight, $code = 0, \Exception $previous = null)19 public function __construct($invalidWeight, $maximumWeight, $code = 0, Exception $previous = null) 20 20 { 21 21 $message = sprintf( -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostNotImplementedException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\BpostException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostNotImplementedException 9 * @package Bpost\BpostApiClient\Exception10 10 */ 11 11 class BpostNotImplementedException extends BpostException 12 12 { 13 13 /** 14 * @param string $message15 * @param int $code16 * @param \Exception $previous14 * @param string $message 15 * @param int $code 16 * @param Exception $previous 17 17 */ 18 public function __construct($message = "", $code = 0, \Exception $previous = null)18 public function __construct($message = '', $code = 0, Exception $previous = null) 19 19 { 20 20 $message = 'Not implemented' . (empty($message) ? '' : ': ' . $message); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostXmlException.php
r1467688 r3119293 7 7 /** 8 8 * Class BpostXmlException 9 * @package Bpost\BpostApiClient\Exception10 9 */ 11 10 class BpostXmlException extends BpostException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlInvalidItemException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostXmlException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostXmlInvalidItemException 9 * @package Bpost\BpostApiClient\Exception\XmlException10 10 */ 11 11 class BpostXmlInvalidItemException extends BpostXmlException 12 12 { 13 13 /** 14 * @param string $message15 * @param int $code16 * @param \Exception $previous14 * @param string $message 15 * @param int $code 16 * @param Exception $previous 17 17 */ 18 public function __construct($message = "", $code = 0, \Exception $previous = null)18 public function __construct($message = '', $code = 0, Exception $previous = null) 19 19 { 20 20 $message = 'Invalid item' . (empty($message) ? '' : ': ' . $message); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlNoReferenceFoundException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostXmlException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostXmlNoReferenceFoundException 9 * @package Bpost\BpostApiClient\Exception\XmlException10 10 */ 11 11 class BpostXmlNoReferenceFoundException extends BpostXmlException 12 12 { 13 13 /** 14 * @param string $message15 * @param int $code16 * @param \Exception $previous14 * @param string $message 15 * @param int $code 16 * @param Exception $previous 17 17 */ 18 public function __construct($message = "", $code = 0, \Exception $previous = null)18 public function __construct($message = '', $code = 0, Exception $previous = null) 19 19 { 20 20 $message = 'No reference found' . (empty($message) ? '' : ': ' . $message); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlNoUserIdFoundException.php
r1467688 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostXmlException; 6 use Exception; 6 7 7 8 /** 8 9 * Class BpostXmlNoUserIdFoundException 9 * @package Bpost\BpostApiClient\Exception\XmlException10 10 */ 11 11 class BpostXmlNoUserIdFoundException extends BpostXmlException 12 12 { 13 13 /** 14 * @param string $message15 * @param int $code16 * @param \Exception $previous14 * @param string $message 15 * @param int $code 16 * @param Exception $previous 17 17 */ 18 public function __construct($message = "", $code = 0, \Exception $previous = null)18 public function __construct($message = '', $code = 0, Exception $previous = null) 19 19 { 20 20 $message = 'No UserId found' . (empty($message) ? '' : ': ' . $message); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/FormHandler.php
r2890340 r3119293 60 60 foreach ($keysToHash as $key) { 61 61 if (isset($this->parameters[$key])) { 62 if (! is_array($this->parameters[$key])) {63 $base .= $key .'='.$this->parameters[$key].'&';62 if (!is_array($this->parameters[$key])) { 63 $base .= $key . '=' . $this->parameters[$key] . '&'; 64 64 } else { 65 65 foreach ($this->parameters[$key] as $entry) { 66 $base .= $key .'='.$entry.'&';66 $base .= $key . '=' . $entry . '&'; 67 67 } 68 68 } … … 80 80 * Get the parameters 81 81 * 82 * @param bool $form 83 * @param bool $includeChecksum 82 * @param bool $form 83 * @param bool $includeChecksum 84 * 84 85 * @return array 85 86 */ … … 109 110 * @param string $key 110 111 * @param mixed $value 112 * 111 113 * @throws BpostInvalidValueException 112 114 * @throws BpostInvalidLengthException -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6.php
r3068120 r3119293 8 8 use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostTaxipostLocatorException; 9 9 use Bpost\BpostApiClient\Geo6\Poi; 10 use SimpleXMLElement; 10 11 11 12 /** … … 13 14 * 14 15 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 16 * 15 17 * @version 3.0.0 18 * 16 19 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 17 20 * @license BSD License … … 63 66 /** 64 67 * Constructor 68 * 65 69 * @param string $partner Static parameter used for protection/statistics 66 70 * @param string $appId Static parameter used for protection/statistics … … 68 72 public function __construct($partner, $appId) 69 73 { 70 $this->setPartner((string) $partner);71 $this->setAppId((string) $appId);74 $this->setPartner((string) $partner); 75 $this->setAppId((string) $appId); 72 76 } 73 77 … … 80 84 $this->apiCaller = new ApiCaller(new Logger()); 81 85 } 86 82 87 return $this->apiCaller; 83 88 } … … 96 101 * @param string $method 97 102 * @param array $parameters 103 * 98 104 * @return string 99 105 */ … … 106 112 * Build the parameters to send (URL-encoded string) 107 113 * 108 * @param string $method 109 * @param array $parameters 114 * @param string $method 115 * @param array $parameters 116 * 110 117 * @return string 111 118 */ … … 124 131 * Make the real call 125 132 * 126 * @param string $method 127 * @param array $parameters 128 * @return \SimpleXMLElement 133 * @param string $method 134 * @param array $parameters 135 * 136 * @return SimpleXMLElement 137 * 129 138 * @throws BpostCurlException 130 139 * @throws BpostInvalidXmlResponseException … … 140 149 CURLOPT_SSL_VERIFYHOST => false, 141 150 CURLOPT_RETURNTRANSFER => true, 142 CURLOPT_TIMEOUT => (int) $this->getTimeOut(),151 CURLOPT_TIMEOUT => (int) $this->getTimeOut(), 143 152 144 153 CURLOPT_POST => true, … … 157 166 158 167 // catch generic errors 159 if (isset($xml['type']) && (string) $xml['type'] == 'TaxipostLocatorError') {160 throw new BpostTaxipostLocatorException((string) $xml->txt, (int)$xml->status);168 if (isset($xml['type']) && (string) $xml['type'] == 'TaxipostLocatorError') { 169 throw new BpostTaxipostLocatorException((string) $xml->txt, (int) $xml->status); 161 170 } 162 171 … … 205 214 public function setTimeOut($seconds) 206 215 { 207 $this->timeOut = (int) $seconds;216 $this->timeOut = (int) $seconds; 208 217 } 209 218 … … 215 224 public function getTimeOut() 216 225 { 217 return (int) $this->timeOut;226 return (int) $this->timeOut; 218 227 } 219 228 … … 227 236 public function getUserAgent() 228 237 { 229 return (string) 'PHP Bpost Geo6/' . self::VERSION . ' ' . $this->userAgent;238 return (string) 'PHP Bpost Geo6/' . self::VERSION . ' ' . $this->userAgent; 230 239 } 231 240 … … 238 247 public function setUserAgent($userAgent) 239 248 { 240 $this->userAgent = (string) $userAgent;249 $this->userAgent = (string) $userAgent; 241 250 } 242 251 … … 257 266 * @param int $limit 258 267 * @param string $country Country: "BE", "FR"... 268 * 259 269 * @return array 270 * 260 271 * @throws BpostCurlException 261 272 * @throws BpostInvalidXmlResponseException 262 273 * @throws BpostTaxipostLocatorException 263 274 */ 264 // public function getNearestServicePoint($street, $number, $zone, $country = 'BE', $language = 'nl', $type = 3, $limit = 10)275 // public function getNearestServicePoint($street, $number, $zone, $country = 'BE', $language = 'nl', $type = 3, $limit = 10) 265 276 public function getNearestServicePoint($street, $number, $zone, $language = 'nl', $type = 3, $limit = 10, $country = 'BE') 266 277 { 267 278 $parameters = array( 268 'Street' => (string) $street,269 'Number' => (string) $number,270 'Zone' => (string) $zone,271 'Country' => (string) $country,272 'Language' => (string) $language,273 'Type' => (int) $type,274 'Limit' => (int) $limit279 'Street' => (string) $street, 280 'Number' => (string) $number, 281 'Zone' => (string) $zone, 282 'Country' => (string) $country, 283 'Language' => (string) $language, 284 'Type' => (int) $type, 285 'Limit' => (int) $limit, 275 286 ); 276 287 … … 285 296 $pois[] = array( 286 297 'poi' => Poi::createFromXML($poi), 287 'distance' => (float) $poi->Distance,298 'distance' => (float) $poi->Distance, 288 299 ); 289 300 } … … 305 316 * 306 317 * @return Poi 318 * 307 319 * @throws BpostCurlException 308 320 * @throws BpostInvalidXmlResponseException … … 312 324 { 313 325 $parameters = array( 314 'Id' => (string) $id,315 'Language' => (string) $language,316 'Type' => (int) $type,317 'Country' => (string) $country,326 'Id' => (string) $id, 327 'Language' => (string) $language, 328 'Type' => (int) $type, 329 'Country' => (string) $country, 318 330 ); 319 331 … … 332 344 * @param int $type 333 345 * @param string $country 346 * 334 347 * @return string 335 348 * … … 339 352 { 340 353 $parameters = array( 341 'Id' => (string) $id,342 'Language' => (string) $language,343 'Type' => (int) $type,344 'Country' => (string) $country,354 'Id' => (string) $id, 355 'Language' => (string) $language, 356 'Type' => (int) $type, 357 'Country' => (string) $country, 345 358 ); 346 359 … … 353 366 * @param int $type 354 367 * @param string $country 368 * 355 369 * @return string 356 370 * … … 368 382 * @param bool $withBpack247 369 383 * @param bool $withClickAndCollectShop 384 * 370 385 * @return int 371 386 */ -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6/Day.php
r2890340 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidDayException; 6 use SimpleXMLElement; 6 7 7 8 /** … … 9 10 * 10 11 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 12 * 11 13 * @version 3.0.0 14 * 12 15 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 13 16 * @license BSD License … … 116 119 /** 117 120 * Get the index for a day 121 * 118 122 * @return int 123 * 119 124 * @throws BpostInvalidDayException 120 125 */ … … 163 168 164 169 /** 165 * @param \SimpleXMLElement $xml 170 * @param SimpleXMLElement $xml 171 * 166 172 * @return Day 167 173 */ 168 public static function createFromXML( \SimpleXMLElement $xml)174 public static function createFromXML(SimpleXMLElement $xml) 169 175 { 170 176 $day = new Day(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6/Poi.php
r2021946 r3119293 4 4 5 5 use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidXmlResponseException; 6 use SimpleXMLElement; 6 7 7 8 /** … … 9 10 * 10 11 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 12 * 11 13 * @version 3.0.0 14 * 12 15 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 13 16 * @license BSD License … … 71 74 public function setCity($city) 72 75 { 73 $this->city = (string) $city;76 $this->city = (string) $city; 74 77 } 75 78 … … 120 123 public function addHour($index, Day $day) 121 124 { 122 $this->hours[(int) $index] = $day;125 $this->hours[(int) $index] = $day; 123 126 } 124 127 … … 144 147 public function setId($id) 145 148 { 146 $this->id = (string) $id;149 $this->id = (string) $id; 147 150 } 148 151 … … 160 163 public function setLatitude($latitude) 161 164 { 162 $this->latitude = (float) $latitude;165 $this->latitude = (float) $latitude; 163 166 } 164 167 … … 176 179 public function setLongitude($longitude) 177 180 { 178 $this->longitude = (float) $longitude;181 $this->longitude = (float) $longitude; 179 182 } 180 183 … … 192 195 public function setNote($note) 193 196 { 194 $this->note = (string) $note;197 $this->note = (string) $note; 195 198 } 196 199 … … 208 211 public function setNr($nr) 209 212 { 210 $this->nr = (string) $nr;213 $this->nr = (string) $nr; 211 214 } 212 215 … … 224 227 public function setOffice($office) 225 228 { 226 $this->office = (string) $office;229 $this->office = (string) $office; 227 230 } 228 231 … … 264 267 public function setStreet($street) 265 268 { 266 $this->street = (string) $street;269 $this->street = (string) $street; 267 270 } 268 271 … … 280 283 public function setType($type) 281 284 { 282 $this->type = (string) $type;285 $this->type = (string) $type; 283 286 } 284 287 … … 296 299 public function setX($x) 297 300 { 298 $this->x = (int) $x;301 $this->x = (int) $x; 299 302 } 300 303 … … 312 315 public function setY($y) 313 316 { 314 $this->y = (int) $y;317 $this->y = (int) $y; 315 318 } 316 319 … … 328 331 public function setZip($zip) 329 332 { 330 $this->zip = (string) $zip;333 $this->zip = (string) $zip; 331 334 } 332 335 … … 352 355 public function setPage($page) 353 356 { 354 $this->page = (string)$page; 355 } 356 357 $this->page = (string) $page; 358 } 357 359 358 360 /** 359 361 * Create a POI based on an XML-object 360 362 * 361 * @param \SimpleXMLElement $xml 363 * @param SimpleXMLElement $xml 364 * 362 365 * @return Poi 366 * 363 367 * @throws BpostInvalidXmlResponseException 364 368 */ 365 public static function createFromXML( \SimpleXMLElement $xml)369 public static function createFromXML(SimpleXMLElement $xml) 366 370 { 367 371 if (!isset($xml->Record)) { … … 374 378 375 379 if (isset($recordXml->Id) && $recordXml->Id != '') { 376 $poi->setId((string) $recordXml->Id);380 $poi->setId((string) $recordXml->Id); 377 381 } 378 382 if (isset($recordXml->ID) && $recordXml->ID != '') { 379 $poi->setId((string) $recordXml->ID);383 $poi->setId((string) $recordXml->ID); 380 384 } 381 385 if (isset($recordXml->Type) && $recordXml->Type != '') { 382 $poi->setType((string) $recordXml->Type);386 $poi->setType((string) $recordXml->Type); 383 387 } 384 388 if (isset($recordXml->Name) && $recordXml->Name != '') { 385 $poi->setOffice((string) $recordXml->Name);389 $poi->setOffice((string) $recordXml->Name); 386 390 } 387 391 if (isset($recordXml->OFFICE) && $recordXml->OFFICE != '') { 388 $poi->setOffice((string) $recordXml->OFFICE);392 $poi->setOffice((string) $recordXml->OFFICE); 389 393 } 390 394 if (isset($recordXml->Street) && $recordXml->Street != '') { 391 $poi->setStreet((string) $recordXml->Street);395 $poi->setStreet((string) $recordXml->Street); 392 396 } 393 397 if (isset($recordXml->STREET) && $recordXml->STREET != '') { 394 $poi->setStreet((string) $recordXml->STREET);398 $poi->setStreet((string) $recordXml->STREET); 395 399 } 396 400 if (isset($recordXml->Number) && $recordXml->Number != '') { 397 $poi->setNr((string) $recordXml->Number);401 $poi->setNr((string) $recordXml->Number); 398 402 } 399 403 if (isset($recordXml->NR) && $recordXml->NR != '') { 400 $poi->setNr((string) $recordXml->NR);404 $poi->setNr((string) $recordXml->NR); 401 405 } 402 406 if (isset($recordXml->Zip) && $recordXml->Zip != '') { 403 $poi->setZip((string) $recordXml->Zip);407 $poi->setZip((string) $recordXml->Zip); 404 408 } 405 409 if (isset($recordXml->ZIP) && $recordXml->ZIP != '') { 406 $poi->setZip((string) $recordXml->ZIP);410 $poi->setZip((string) $recordXml->ZIP); 407 411 } 408 412 if (isset($recordXml->City) && $recordXml->City != '') { 409 $poi->setCity((string) $recordXml->City);413 $poi->setCity((string) $recordXml->City); 410 414 } 411 415 if (isset($recordXml->CITY) && $recordXml->CITY != '') { 412 $poi->setCity((string) $recordXml->CITY);416 $poi->setCity((string) $recordXml->CITY); 413 417 } 414 418 if (isset($recordXml->X) && $recordXml->X != '') { 415 $poi->setX((int) $recordXml->X);419 $poi->setX((int) $recordXml->X); 416 420 } 417 421 if (isset($recordXml->Y) && $recordXml->Y != '') { 418 $poi->setY((int) $recordXml->Y);422 $poi->setY((int) $recordXml->Y); 419 423 } 420 424 if (isset($recordXml->Longitude) && $recordXml->Longitude != '') { 421 $poi->setLongitude((float) $recordXml->Longitude);425 $poi->setLongitude((float) $recordXml->Longitude); 422 426 } 423 427 if (isset($recordXml->Latitude) && $recordXml->Latitude != '') { 424 $poi->setLatitude((float) $recordXml->Latitude);428 $poi->setLatitude((float) $recordXml->Latitude); 425 429 } 426 430 if (isset($recordXml->Services) && isset($recordXml->Services->Service)) { … … 457 461 458 462 if (isset($recordXml->ClosedFrom) && $recordXml->ClosedFrom != '') { 459 $closedFrom = (string) $recordXml->ClosedFrom;463 $closedFrom = (string) $recordXml->ClosedFrom; 460 464 $poi->setClosedFrom((array) $closedFrom); 461 465 } 462 466 if (isset($recordXml->ClosedTo) && $recordXml->ClosedTo != '') { 463 $closedTo = (string) $recordXml->ClosedTo;464 $poi->setClosedTo((array) $closedTo);467 $closedTo = (string) $recordXml->ClosedTo; 468 $poi->setClosedTo((array) $closedTo); 465 469 } 466 470 if (isset($recordXml->NOTE) && $recordXml->NOTE != '') { 467 $poi->setNote((string) $recordXml->NOTE);471 $poi->setNote((string) $recordXml->NOTE); 468 472 } 469 473 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6/Service.php
r1467688 r3119293 2 2 3 3 namespace Bpost\BpostApiClient\Geo6; 4 5 use SimpleXMLElement; 4 6 5 7 /** … … 7 9 * 8 10 * @author Tijs Verkoyen <php-bpost@verkoyen.eu> 11 * 9 12 * @version 3.0.0 13 * 10 14 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved. 11 15 * @license BSD License … … 77 81 78 82 /** 79 * @param \SimpleXMLElement $xml 83 * @param SimpleXMLElement $xml 84 * 80 85 * @return Service 81 86 */ 82 public static function createFromXML( \SimpleXMLElement $xml)87 public static function createFromXML(SimpleXMLElement $xml) 83 88 { 84 89 $service = new Service(); -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Logger.php
r2890340 r3119293 7 7 /** 8 8 * Class Logger 9 * @package Bpost\BpostApiClient10 9 */ 11 10 class Logger 12 11 { 13 /** @var LoggerInterface */12 /** @var LoggerInterface */ 14 13 private $logger; 15 14 -
bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/tijsverkoyen_classes.php
r1529584 r3119293 18 18 namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class AutomaticSecondPresentation extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\AutomaticSecondPresentation {} } // src/Bpost/Order/Box/Option/AutomaticSecondPresentation.php 19 19 namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class CashOnDelivery extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\CashOnDelivery {} } // src/Bpost/Order/Box/Option/CashOnDelivery.php 20 namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class Insurance extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\Insur ance {} } // src/Bpost/Order/Box/Option/Insurance.php20 namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class Insurance extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\Insured {} } // src/Bpost/Order/Box/Option/Insured.php 21 21 namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class Messaging extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging {} } // src/Bpost/Order/Box/Option/Messaging.php 22 22 namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class SaturdayDelivery extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\SaturdayDelivery {} } // src/Bpost/Order/Box/Option/SaturdayDelivery.php -
bpost-shipping/trunk/vendor/composer/autoload_psr4.php
r3079657 r3119293 7 7 8 8 return array( 9 'Tests\\' => array($vendorDir . '/antidot-be/bpost-api-library/tests'), 9 10 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 10 11 'Bpost\\BpostApiClient\\' => array($vendorDir . '/antidot-be/bpost-api-library/src'), -
bpost-shipping/trunk/vendor/composer/autoload_static.php
r3117106 r3119293 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( 10 'T' => 11 array ( 12 'Tests\\' => 6, 13 ), 10 14 'P' => 11 15 array ( … … 19 23 20 24 public static $prefixDirsPsr4 = array ( 25 'Tests\\' => 26 array ( 27 0 => __DIR__ . '/..' . '/antidot-be/bpost-api-library/tests', 28 ), 21 29 'Psr\\Log\\' => 22 30 array ( -
bpost-shipping/trunk/vendor/composer/installed.json
r3079657 r3119293 3 3 { 4 4 "name": "antidot-be/bpost-api-library", 5 "version": " 3.4.11",6 "version_normalized": " 3.4.11.0",5 "version": "dev-master", 6 "version_normalized": "dev-master", 7 7 "source": { 8 8 "type": "git", 9 9 "url": "https://github.com/Antidot-be/bpost-api-library.git", 10 "reference": " eff1fe611d1b39f56d257515d293a4f61ba0cc2c"10 "reference": "f7a3a903e7acb7e7e159016ed37bef05c4aa408d" 11 11 }, 12 12 "dist": { 13 13 "type": "zip", 14 "url": "https://api.github.com/repos/Antidot-be/bpost-api-library/zipball/ eff1fe611d1b39f56d257515d293a4f61ba0cc2c",15 "reference": " eff1fe611d1b39f56d257515d293a4f61ba0cc2c",14 "url": "https://api.github.com/repos/Antidot-be/bpost-api-library/zipball/f7a3a903e7acb7e7e159016ed37bef05c4aa408d", 15 "reference": "f7a3a903e7acb7e7e159016ed37bef05c4aa408d", 16 16 "shasum": "" 17 17 }, … … 28 28 "phpunit/phpunit": "^5" 29 29 }, 30 "time": "2022-11-22T14:19:58+00:00", 30 "time": "2024-07-16T14:04:09+00:00", 31 "default-branch": true, 31 32 "type": "library", 32 33 "installation-source": "dist", 33 34 "autoload": { 34 35 "psr-4": { 36 "Tests\\": "tests/", 35 37 "Bpost\\BpostApiClient\\": "src/" 36 38 }, … … 64 66 "support": { 65 67 "issues": "https://github.com/Antidot-be/bpost-api-library/issues", 66 "source": "https://github.com/Antidot-be/bpost-api-library/tree/ 3.4.11"68 "source": "https://github.com/Antidot-be/bpost-api-library/tree/master" 67 69 }, 68 70 "install-path": "../antidot-be/bpost-api-library" -
bpost-shipping/trunk/vendor/composer/installed.php
r3079657 r3119293 12 12 'versions' => array( 13 13 'antidot-be/bpost-api-library' => array( 14 'pretty_version' => ' 3.4.11',15 'version' => ' 3.4.11.0',14 'pretty_version' => 'dev-master', 15 'version' => 'dev-master', 16 16 'type' => 'library', 17 17 'install_path' => __DIR__ . '/../antidot-be/bpost-api-library', 18 'aliases' => array(), 19 'reference' => 'eff1fe611d1b39f56d257515d293a4f61ba0cc2c', 18 'aliases' => array( 19 0 => '9999999-dev', 20 ), 21 'reference' => 'f7a3a903e7acb7e7e159016ed37bef05c4aa408d', 20 22 'dev_requirement' => false, 21 23 ),
Note: See TracChangeset
for help on using the changeset viewer.