Plugin Directory

Changeset 3119293


Ignore:
Timestamp:
07/16/2024 02:15:54 PM (21 months ago)
Author:
antidot-dev
Message:

Release 3.1.7

Location:
bpost-shipping/trunk
Files:
17 added
83 edited

Legend:

Unmodified
Added
Removed
  • bpost-shipping/trunk/bpost-shipping.php

    r3117106 r3119293  
    66 * Author: bpost
    77 * Author URI: https://www.bpost.be/
    8  * Version: 3.1.6
     8 * Version: 3.1.7
    99 * WC requires at least: 3.0
    1010 * WC tested up to: 8.9
     
    1515define( 'BPOST_PLUGIN_DIR', __DIR__ );
    1616define( 'BPOST_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    17 define( 'BPOST_PLUGIN_VERSION', '3.1.6' );
     17define( 'BPOST_PLUGIN_VERSION', '3.1.7' );
    1818
    1919/**
  • bpost-shipping/trunk/languages/bpost_shipping.pot

    r3117106 r3119293  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: bpost shipping 3.1.6\n"
     5"Project-Id-Version: bpost shipping 3.1.7\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/package\n"
    7 "POT-Creation-Date: 2024-07-12 14:01:54+00:00\n"
     7"POT-Creation-Date: 2024-07-16 14:14:10+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=UTF-8\n"
     
    197197msgstr ""
    198198
    199 #. #-#-#-#-#  bpost_shipping.pot (bpost shipping 3.1.6)  #-#-#-#-#
     199#. #-#-#-#-#  bpost_shipping.pot (bpost shipping 3.1.7)  #-#-#-#-#
    200200#. Author of the plugin/theme
    201201#: classes/class-wc-bpost-shipping-method.php:264
  • bpost-shipping/trunk/readme.txt

    r3117106 r3119293  
    88Tested up to: 6.5
    99Requires PHP: 7.4
    10 Stable tag: 3.1.6
     10Stable tag: 3.1.7
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1201205. Configure your bpost shipping settings under the Woocommerce shipping > bpost shipping tab
    121121== Changelog ==
     122
     123#### 3.1.7
     124
     125*Release date: 2024-07-16*
     126
     127* international pickup points could generate an error
    122128
    123129#### 3.1.6
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/.github/workflows/test.yml

    r2890340 r3119293  
    1313          php_version: 7.4
    1414
    15       - name: php-cs-fixer static analysis
    16         uses: docker://oskarstark/php-cs-fixer-ga
    17         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
    1919
    2020      - name: PHPUnit Tests
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/.php-cs-fixer.dist.php

    r2890340 r3119293  
    55$config = new PhpCsFixer\Config();
    66$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,
    918);
    1019$config->setRules($rules);
     
    1726$finder
    1827    ->in(__DIR__ . '/src')
     28    ->in(__DIR__ . '/tests')
    1929    ->notName('tijsverkoyen_classes.php')
    2030    ->sortByName();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/composer.json

    r2890340 r3119293  
    11{
    22  "name": "antidot-be/bpost-api-library",
    3   "version": "3.4.11",
     3  "version": "3.5.1",
    44  "type": "library",
    55  "description": "bpost API library is a PHP library to communicate with the bpost API.",
     
    3737  "autoload": {
    3838    "psr-4": {
    39       "Bpost\\BpostApiClient\\": "src/"
     39      "Bpost\\BpostApiClient\\": "src/",
     40      "Tests\\": "tests/"
    4041    },
    4142    "classmap": [
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/ApiCaller/ApiCaller.php

    r2890340 r3119293  
    1313/**
    1414 * Class ApiCaller
    15  * @package Bpost\BpostApiClient\ApiCaller
     15 *
    1616 * @codeCoverageIgnore That makes a HTTP request with the bpost API
    1717 */
     
    3232    /**
    3333     * ApiCaller constructor.
     34     *
    3435     * @param Logger $logger
    3536     */
     
    6364    }
    6465
    65 
    6666    /**
    6767     * @param array $options
     68     *
    6869     * @return bool
     70     *
    6971     * @throws BpostApiBusinessException
    7072     * @throws BpostApiResponseException
     
    9395            'status' => $errorNumber . ' (' . $errorMessage . ')',
    9496            'headers' => $headers,
    95             'response' => $this->responseBody
     97            'response' => $this->responseBody,
    9698        ));
    9799
     
    122124    public function getHttpCodeType()
    123125    {
    124         return 100 * (int)($this->responseHttpCode / 100);
     126        return 100 * (int) ($this->responseHttpCode / 100);
    125127    }
    126128}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpack247.php

    r2890340 r3119293  
    88use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostCurlException;
    99use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidResponseException;
     10use DOMDocument;
     11use SimpleXMLElement;
    1012
    1113/**
     
    1315 *
    1416 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     17 *
    1518 * @version   3.0.0
     19 *
    1620 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1721 * @license   BSD License
     
    7074     * Make the call
    7175     *
    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     *
    7682     * @throws BpostApiBusinessException
    7783     * @throws BpostApiSystemException
     
    223229     * @param Customer $customer
    224230     *
    225      * @return \SimpleXMLElement
     231     * @return SimpleXMLElement
     232     *
    226233     * @throws BpostApiBusinessException
    227234     * @throws BpostApiSystemException
     
    233240        $url = '/customer';
    234241
    235         $document = new \DOMDocument('1.0', 'utf-8');
     242        $document = new DOMDocument('1.0', 'utf-8');
    236243        $document->preserveWhiteSpace = false;
    237244        $document->formatOutput = true;
     
    253260     * Retrieve member information
    254261     *
    255      * @param  string $id
     262     * @param string $id
    256263     *
    257264     * @return Customer
     265     *
    258266     * @throws BpostApiBusinessException
    259267     * @throws BpostApiSystemException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpack247/Customer.php

    r2890340 r3119293  
    55use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    66use Bpost\BpostApiClient\Exception\XmlException\BpostXmlNoUserIdFoundException;
     7use DateTime;
     8use DOMDocument;
     9use DOMElement;
     10use SimpleXMLElement;
    711
    812/**
     
    101105
    102106    /**
    103      * @var \DateTime
     107     * @var DateTime
    104108     */
    105109    private $dateOfBirth;
     
    131135
    132136    /**
    133      * @param boolean $activated
     137     * @param bool $activated
    134138     */
    135139    public function setActivated($activated)
     
    139143
    140144    /**
    141      * @return boolean
     145     * @return bool
    142146     */
    143147    public function getActivated()
     
    163167
    164168    /**
    165      * @param \DateTime $dateOfBirth
     169     * @param DateTime $dateOfBirth
    166170     */
    167171    public function setDateOfBirth($dateOfBirth)
     
    171175
    172176    /**
    173      * @return \DateTime
     177     * @return DateTime
    174178     */
    175179    public function getDateOfBirth()
     
    227231
    228232    /**
    229      * @param boolean $isComfortZoneUser
     233     * @param bool $isComfortZoneUser
    230234     */
    231235    public function setIsComfortZoneUser($isComfortZoneUser)
     
    235239
    236240    /**
    237      * @return boolean
     241     * @return bool
    238242     */
    239243    public function getIsComfortZoneUser()
     
    307311
    308312    /**
    309      * @param boolean $optIn
     313     * @param bool $optIn
    310314     */
    311315    public function setOptIn($optIn)
     
    315319
    316320    /**
    317      * @return boolean
     321     * @return bool
    318322     */
    319323    public function getOptIn()
     
    364368    /**
    365369     * @param string $preferredLanguage
     370     *
    366371     * @throws BpostInvalidValueException
    367372     */
     
    400405
    401406    /**
    402      * @param boolean $receivePromotions
     407     * @param bool $receivePromotions
    403408     */
    404409    public function setReceivePromotions($receivePromotions)
     
    408413
    409414    /**
    410      * @return boolean
     415     * @return bool
    411416     */
    412417    public function getReceivePromotions()
     
    433438    /**
    434439     * @param string $title
     440     *
    435441     * @throws BpostInvalidValueException
    436442     */
     
    480486
    481487    /**
    482      * @param boolean $useInformationForThirdParty
     488     * @param bool $useInformationForThirdParty
    483489     */
    484490    public function setUseInformationForThirdParty($useInformationForThirdParty)
     
    488494
    489495    /**
    490      * @return boolean
     496     * @return bool
    491497     */
    492498    public function getUseInformationForThirdParty()
     
    530536     * Return the object as an array for usage in the XML
    531537     *
    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)
    536543    {
    537544        $customer = $document->createElement(
     
    564571
    565572    /**
    566      * @param  \SimpleXMLElement $xml
     573     * @param SimpleXMLElement $xml
    567574     *
    568575     * @return Customer
     576     *
    569577     * @throws BpostInvalidValueException
    570578     * @throws BpostXmlNoUserIdFoundException
    571579     */
    572     public static function createFromXML(\SimpleXMLElement $xml)
     580    public static function createFromXML(SimpleXMLElement $xml)
    573581    {
    574582        // @todo work with classmaps ...
     
    598606        }
    599607        if (isset($xml->DateOfBirth) && $xml->DateOfBirth != '') {
    600             $dateTime = new \DateTime((string) $xml->DateOfBirth);
     608            $dateTime = new DateTime((string) $xml->DateOfBirth);
    601609            $customer->setDateOfBirth($dateTime);
    602610        }
     
    660668
    661669    /**
    662      * @param \DOMDocument $document
    663      * @param \DOMElement $customer
    664      */
    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)
    666674    {
    667675        if ($this->getFirstName() !== null) {
     
    684692
    685693    /**
    686      * @param \DOMDocument $document
    687      * @param \DOMElement $customer
    688      */
    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)
    690698    {
    691699        if ($this->getEmail() !== null) {
     
    716724
    717725    /**
    718      * @param \DOMDocument $document
    719      * @param \DOMElement $customer
    720      */
    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)
    722730    {
    723731        if ($this->getStreet() !== null) {
     
    740748
    741749    /**
    742      * @param \DOMDocument $document
    743      * @param \DOMElement $customer
    744      */
    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)
    746754    {
    747755        if ($this->getPreferredLanguage() !== null) {
     
    756764
    757765    /**
    758      * @param \DOMDocument $document
    759      * @param \DOMElement $customer
    760      */
    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)
    762770    {
    763771        if ($this->getTitle() !== null) {
     
    772780
    773781    /**
    774      * @param \DOMDocument $document
    775      * @param \DOMElement $customer
    776      */
    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)
    778786    {
    779787        if ($this->getPostalCode() !== null) {
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpack247/CustomerPackStation.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpack247;
     4
     5use SimpleXMLElement;
    46
    57/**
     
    7476
    7577    /**
    76      * @param  \SimpleXMLElement   $xml
     78     * @param SimpleXMLElement $xml
     79     *
    7780     * @return CustomerPackStation
    7881     */
    79     public static function createFromXML(\SimpleXMLElement $xml)
     82    public static function createFromXML(SimpleXMLElement $xml)
    8083    {
    8184        $packStation = new CustomerPackStation();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost.php

    r2890340 r3119293  
    44
    55use Bpost\BpostApiClient\ApiCaller\ApiCaller;
    6 use Bpost\BpostApiClient\Bpost\CreateLabelInBulkForOrders;
     6use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateLabelForBoxBuilder;
     7use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateLabelForOrderBuilder;
     8use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateLabelInBulkForOrdersBuilder;
     9use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\CreateOrReplaceOrderBuilder;
     10use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\FetchOrderBuilder;
     11use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\FetchProductConfigBuilder;
     12use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\HttpRequestBuilderInterface;
     13use Bpost\BpostApiClient\Bpost\HttpRequestBuilder\ModifyOrderBuilder;
    714use Bpost\BpostApiClient\Bpost\Labels;
    815use Bpost\BpostApiClient\Bpost\Order;
    916use Bpost\BpostApiClient\Bpost\Order\Box;
    10 use Bpost\BpostApiClient\Bpost\Order\Box\Option\Insurance;
     17use Bpost\BpostApiClient\Bpost\Order\Box\Option\Insured;
    1118use Bpost\BpostApiClient\Bpost\ProductConfiguration;
    1219use Bpost\BpostApiClient\Common\ValidatedValue\LabelFormat;
     
    1623use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidXmlResponseException;
    1724use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     25use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
    1826use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
     27use Bpost\BpostApiClient\Exception\XmlException\BpostXmlNoReferenceFoundException;
    1928use Psr\Log\LoggerInterface;
     29use SimpleXMLElement;
    2030
    2131/**
     
    2333 *
    2434 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     35 *
    2536 * @version   3.0.0
     37 *
    2638 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    2739 * @license   BSD License
     
    3345
    3446    // 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';
    3648
    3749    // current version
     
    91103    private $apiUrl;
    92104
    93     /** @var  Logger */
     105    /** @var Logger */
    94106    private $logger;
    95107
    96     // class methods
    97108    /**
    98109     * Create Bpost instance
     
    104115    public function __construct($accountId, $passPhrase, $apiUrl = self::API_URL)
    105116    {
    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;
    109120        $this->logger = new Logger();
    110121    }
     
    118129            $this->apiCaller = new ApiCaller($this->logger);
    119130        }
     131
    120132        return $this->apiCaller;
    121133    }
     
    143155     * Decode the response
    144156     *
    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     *
    148161     * @return array
     162     *
    149163     * @throws BpostXmlInvalidItemException
    150164     */
    151165    private static function decodeResponse($item, $return = null, $i = 0)
    152166    {
    153         if (!$item instanceof \SimpleXMLElement) {
     167        if (!$item instanceof SimpleXMLElement) {
    154168            throw new BpostXmlInvalidItemException();
    155169        }
     
    158172            'barcode',
    159173            'orderLine',
    160             Insurance::INSURANCE_TYPE_ADDITIONAL_INSURANCE,
     174            Insured::INSURANCE_TYPE_ADDITIONAL_INSURANCE,
    161175            Box\Option\Messaging::MESSAGING_TYPE_INFO_DISTRIBUTED,
    162             'infoPugo'
     176            'infoPugo',
    163177        );
    164178        $integerKeys = array('totalPrice');
    165179
    166         /** @var \SimpleXMLElement $value */
     180        /** @var SimpleXMLElement $value */
    167181        foreach ($item as $key => $value) {
    168             $attributes = (array)$value->attributes();
     182            $attributes = (array) $value->attributes();
    169183
    170184            if (!empty($attributes) && isset($attributes['@attributes'])) {
     
    173187
    174188            // empty
    175             if (isset($value['nil']) && (string)$value['nil'] === 'true') {
     189            if (isset($value['nil']) && (string) $value['nil'] === 'true') {
    176190                $return[$key] = null;
    177191            } // empty
    178             elseif (isset($value[0]) && (string)$value == '') {
     192            elseif (isset($value[0]) && (string) $value == '') {
    179193                if (in_array($key, $arrayKeys)) {
    180194                    $return[$key][] = self::decodeResponse($value);
     
    185199                // arrays
    186200                if (in_array($key, $arrayKeys)) {
    187                     $return[$key][] = (string)$value;
     201                    $return[$key][] = (string) $value;
    188202                } // booleans
    189                 elseif ((string)$value == 'true') {
     203                elseif ((string) $value == 'true') {
    190204                    $return[$key] = true;
    191                 } elseif ((string)$value == 'false') {
     205                } elseif ((string) $value == 'false') {
    192206                    $return[$key] = false;
    193207                } // integers
    194208                elseif (in_array($key, $integerKeys)) {
    195                     $return[$key] = (int)$value;
     209                    $return[$key] = (int) $value;
    196210                } // fallback to string
    197211                else {
    198                     $return[$key] = (string)$value;
     212                    $return[$key] = (string) $value;
    199213                }
    200214            }
     
    207221     * Make the call
    208222     *
    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
    222234        // build Authorization header
    223235        $headers[] = 'Authorization: Basic ' . $this->getAuthorizationHeader();
     
    225237        // set options
    226238        $options = array();
    227         $options[CURLOPT_URL] = $this->apiUrl . '/' . $this->accountId . $url;
     239        $options[CURLOPT_URL] = $this->apiUrl . '/' . $this->accountId . $builder->getUrl();
    228240        if ($this->getPort() != 0) {
    229241            $options[CURLOPT_PORT] = $this->getPort();
     
    231243        $options[CURLOPT_USERAGENT] = $this->getUserAgent();
    232244        $options[CURLOPT_RETURNTRANSFER] = true;
    233         $options[CURLOPT_TIMEOUT] = (int)$this->getTimeOut();
     245        $options[CURLOPT_TIMEOUT] = (int) $this->getTimeOut();
    234246        $options[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1;
    235247        $options[CURLOPT_HTTPHEADER] = $headers;
    236248
    237         if ($method == 'POST') {
     249        if ($builder->getMethod() == 'POST') {
    238250            $options[CURLOPT_POST] = true;
    239             $options[CURLOPT_POSTFIELDS] = $body;
     251            $options[CURLOPT_POSTFIELDS] = $builder->getXml();
    240252        }
    241253
     
    255267            ) {
    256268                // 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;
    259271
    260272                // throw exception
     
    265277            if (
    266278                ($contentType !== null && substr_count($contentType, 'text/plain') > 0) ||
    267                 (in_array($httpCode, array(400, 404)))
     279                in_array($httpCode, array(400, 404))
    268280            ) {
    269281                $message = $response;
     
    274286
    275287        // if we don't expect XML we can return the content here
    276         if (!$expectXML) {
     288        if (!$builder->isExpectXml()) {
    277289            return $response;
    278290        }
     
    325337    public function getPort()
    326338    {
    327         return (int)$this->port;
     339        return (int) $this->port;
    328340    }
    329341
     
    335347    public function getTimeOut()
    336348    {
    337         return (int)$this->timeOut;
     349        return (int) $this->timeOut;
    338350    }
    339351
     
    347359    public function getUserAgent()
    348360    {
    349         return (string)'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent;
     361        return (string) 'PHP Bpost/' . self::VERSION . ' ' . $this->userAgent;
    350362    }
    351363
     
    358370    public function setTimeOut($seconds)
    359371    {
    360         $this->timeOut = (int)$seconds;
     372        $this->timeOut = (int) $seconds;
    361373    }
    362374
     
    369381    public function setUserAgent($userAgent)
    370382    {
    371         $this->userAgent = (string)$userAgent;
     383        $this->userAgent = (string) $userAgent;
    372384    }
    373385
     
    377389     * Creates a new order. If an order with the same orderReference already exists
    378390     *
    379      * @param  Order $order
     391     * @param Order $order
    380392     *
    381393     * @return bool
    382      * @throws BpostCurlException
    383      * @throws BpostInvalidResponseException
    384      * @throws BpostInvalidSelectionException
     394     *
     395     * @throws BpostCurlException
     396     * @throws BpostInvalidResponseException
     397     * @throws BpostInvalidSelectionException
     398     * @throws BpostInvalidXmlResponseException
    385399     */
    386400    public function createOrReplaceOrder(Order $order)
    387401    {
    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) == '';
    414405    }
    415406
     
    417408     * Fetch an order
    418409     *
    419      * @param $reference
     410     * @param string $reference
    420411     *
    421412     * @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
    426420     */
    427421    public function fetchOrder($reference)
    428422    {
    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);
    439426
    440427        return Order::createFromXML($xml);
     
    445432     *
    446433     * @return ProductConfiguration
    447      * @throws BpostCurlException
    448      * @throws BpostInvalidResponseException
    449      * @throws BpostInvalidSelectionException
     434     *
     435     * @throws BpostCurlException
     436     * @throws BpostInvalidResponseException
     437     * @throws BpostInvalidSelectionException
     438     * @throws BpostInvalidXmlResponseException
    450439     */
    451440    public function fetchProductConfig()
    452441    {
    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);
    464445
    465446        return ProductConfiguration::createFromXML($xml);
     
    469450     * Modify the status for an order.
    470451     *
    471      * @param  string $reference The reference for an order
    472      * @param  string $status    The new status, allowed values are: OPEN, PENDING, CANCELLED, COMPLETED, ON-HOLD or PRINTED
     452     * @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
    473454     *
    474455     * @return bool
     456     *
    475457     * @throws BpostCurlException
    476458     * @throws BpostInvalidResponseException
    477459     * @throws BpostInvalidSelectionException
    478460     * @throws BpostInvalidValueException
     461     * @throws BpostInvalidXmlResponseException
    479462     */
    480463    public function modifyOrderStatus($reference, $status)
    481464    {
    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) == '';
    514468    }
    515469
    516470    // labels
     471
    517472    /**
    518473     * Get the possible label formats
     
    529484
    530485    /**
    531      * Generic method to centralize handling of labels
    532      *
    533      * @param  string $url
    534      * @param  string $format
    535      * @param  bool   $withReturnLabels
    536      * @param  bool   $asPdf
    537      *
    538      * @return Bpost\Label[]
    539      * @throws BpostCurlException
    540      * @throws BpostInvalidResponseException
    541      * @throws BpostInvalidSelectionException
    542      * @throws BpostInvalidValueException
    543      */
    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             $headers
    570         );
    571 
    572         return Labels::createFromXML($xml);
    573     }
    574 
    575     /**
    576486     * Create the labels for all unprinted boxes in an order.
    577487     * The service will return labels for all unprinted boxes for that order.
     
    579489     * had already been printed will remain the same.
    580490     *
    581      * @param  string $reference        The reference for an order
    582      * @param  string $format           The desired format, allowed values are: A4, A6
    583      * @param  bool   $withReturnLabels Should return labels be returned?
    584      * @param  bool   $asPdf            Should we retrieve the PDF-version instead of PNG
     491     * @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
    585495     *
    586496     * @return Bpost\Label[]
    587      * @throws BpostInvalidValueException
     497     *
     498     * @throws BpostCurlException
     499     * @throws BpostInvalidResponseException
     500     * @throws BpostInvalidSelectionException
     501     * @throws BpostInvalidXmlResponseException
    588502     */
    589503    public function createLabelForOrder(
     
    593507        $asPdf = false
    594508    ) {
    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);
    598514    }
    599515
     
    601517     * Create a label for a known barcode.
    602518     *
    603      * @param  string $barcode          The barcode of the parcel
    604      * @param  string $format           The desired format, allowed values are: A4, A6
    605      * @param  bool   $withReturnLabels Should return labels be returned?
    606      * @param  bool   $asPdf            Should we retrieve the PDF-version instead of PNG
     519     * @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
    607523     *
    608524     * @return Bpost\Label[]
    609      * @throws BpostInvalidValueException
     525     *
     526     * @throws BpostCurlException
     527     * @throws BpostInvalidResponseException
     528     * @throws BpostInvalidSelectionException
     529     * @throws BpostInvalidXmlResponseException
    610530     */
    611531    public function createLabelForBox(
     
    615535        $asPdf = false
    616536    ) {
    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);
    620542    }
    621543
     
    626548     * a certain box was not yet printed, it will have the status PRINTED
    627549     *
    628      * @param  array  $references       The references for the order
    629      * @param  string $format           The desired format, allowed values are: A4, A6
    630      * @param  bool   $withReturnLabels Should return labels be returned?
    631      * @param  bool   $asPdf            Should we retrieve the PDF-version instead of PNG
    632      * @param  bool   $forcePrinting    Reprint a already printed label
     550     * @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
    633555     *
    634556     * @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
    639562     */
    640563    public function createLabelInBulkForOrders(
     
    645568        $forcePrinting = false
    646569    ) {
    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
    654576        );
    655577
     578        $xml = $this->doCall($builder);
     579
    656580        return Labels::createFromXML($xml);
    657581    }
     
    669593    /**
    670594     * @param int $weight in grams
     595     *
    671596     * @return bool
    672597     */
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Label.php

    r2890340 r3119293  
    55use Bpost\BpostApiClient\Bpost\Label\Barcode;
    66use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     7use SimpleXMLElement;
    78
    89/**
     
    8889    /**
    8990     * @param string $mimeType
     91     *
    9092     * @throws BpostInvalidValueException
    9193     */
     
    130132
    131133    /**
    132      * @param  \SimpleXMLElement $xml
     134     * @param SimpleXMLElement $xml
    133135     *
    134136     * @return Label
     137     *
    135138     * @throws BpostInvalidValueException
    136139     */
    137     public static function createFromXML(\SimpleXMLElement $xml)
     140    public static function createFromXML(SimpleXMLElement $xml)
    138141    {
    139142        $label = new Label();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Label/Barcode.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Label;
    44
     5use SimpleXMLElement;
     6
    57/**
    68 * Class Barcode
    7  * @package Bpost\BpostApiClient\Bpost\Label
    89 */
    910class Barcode
     
    2425    public function setBarcode($barcode)
    2526    {
    26         $this->barcode = (string)$barcode;
     27        $this->barcode = (string) $barcode;
    2728    }
    2829
     
    5253
    5354    /**
    54      * @param \SimpleXMLElement $xml
     55     * @param SimpleXMLElement $xml
    5556     *
    5657     * @return self
    5758     */
    58     public static function createFromXML(\SimpleXMLElement $xml)
     59    public static function createFromXML(SimpleXMLElement $xml)
    5960    {
    6061        $self = new self();
    6162        if (isset($xml->barcode) && $xml->barcode != '') {
    62             $self->setBarcode((string)$xml->barcode);
     63            $self->setBarcode((string) $xml->barcode);
    6364        }
    6465        if (isset($xml->reference) && $xml->reference != '') {
    65             $self->setReference((string)$xml->reference);
     66            $self->setReference((string) $xml->reference);
    6667        }
    6768
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Labels.php

    r1467688 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost;
     4
     5use SimpleXMLElement;
    46
    57/**
     
    911{
    1012    /**
    11      * @param \SimpleXMLElement $xml
     13     * @param SimpleXMLElement $xml
    1214     *
    1315     * @return Label[]
    1416     */
    15     public static function createFromXML(\SimpleXMLElement $xml)
     17    public static function createFromXML(SimpleXMLElement $xml)
    1618    {
    1719        $labels = array();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order.php

    r1467688 r3119293  
    77use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
    88use Bpost\BpostApiClient\Exception\XmlException\BpostXmlNoReferenceFoundException;
     9use DOMDocument;
     10use DOMElement;
     11use SimpleXMLElement;
    912
    1013/**
     
    146149     * Return the object as an array for usage in the XML
    147150     *
    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)
    153157    {
    154158        $order = $document->createElement(
     
    157161        $order->setAttribute(
    158162            'xmlns:common',
    159             'http://schema.post.be/shm/deepintegration/v3/common'
     163            'http://schema.post.be/shm/deepintegration/v5/common'
    160164        );
    161165        $order->setAttribute(
    162166            'xmlns:tns',
    163             'http://schema.post.be/shm/deepintegration/v3/'
     167            'http://schema.post.be/shm/deepintegration/v5/'
    164168        );
    165169        $order->setAttribute(
    166170            'xmlns',
    167             'http://schema.post.be/shm/deepintegration/v3/national'
     171            'http://schema.post.be/shm/deepintegration/v5/national'
    168172        );
    169173        $order->setAttribute(
    170174            'xmlns:international',
    171             'http://schema.post.be/shm/deepintegration/v3/international'
     175            'http://schema.post.be/shm/deepintegration/v5/international'
    172176        );
    173177        $order->setAttribute(
     
    177181        $order->setAttribute(
    178182            'xsi:schemaLocation',
    179             'http://schema.post.be/shm/deepintegration/v3/'
     183            'http://schema.post.be/shm/deepintegration/v5/'
    180184        );
    181185
     
    230234
    231235    /**
    232      * @param  \SimpleXMLElement $xml
     236     * @param SimpleXMLElement $xml
    233237     *
    234238     * @return Order
     239     *
    235240     * @throws BpostXmlNoReferenceFoundException
    236241     * @throws BpostNotImplementedException
    237242     */
    238     public static function createFromXML(\SimpleXMLElement $xml)
     243    public static function createFromXML(SimpleXMLElement $xml)
    239244    {
    240245        // @todo work with classmaps ...
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Address.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
     7use DOMDocument;
     8use DOMElement;
     9use SimpleXMLElement;
    610
    711/**
     
    4650    /**
    4751     * @param string $box
     52     *
    4853     * @throws BpostInvalidLengthException
    4954     */
     
    6772    /**
    6873     * @param string $countryCode
     74     *
    6975     * @throws BpostInvalidLengthException
    7076     */
     
    8894    /**
    8995     * @param string $locality
     96     *
    9097     * @throws BpostInvalidLengthException
    9198     */
     
    109116    /**
    110117     * @param string $number
     118     *
    111119     * @throws BpostInvalidLengthException
    112120     */
     
    130138    /**
    131139     * @param string $postalCode
     140     *
    132141     * @throws BpostInvalidLengthException
    133142     */
     
    151160    /**
    152161     * @param string $streetName
     162     *
    153163     * @throws BpostInvalidLengthException
    154164     */
     
    211221     * Return the object as an array for usage in the XML
    212222     *
    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')
    218229    {
    219230        $tagName = static::TAG_NAME;
     
    230241
    231242    /**
    232      * @param  \SimpleXMLElement $xml
     243     * @param SimpleXMLElement $xml
     244     *
    233245     * @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)
    237250    {
    238251        $address = new Address();
     
    261274
    262275    /**
    263      * @param \DOMDocument $document
     276     * @param DOMDocument $document
    264277     * @param $prefix
    265      * @param \DOMElement $address
    266      */
    267     private function streetToXML(\DOMDocument $document, $prefix, \DOMElement $address)
     278     * @param DOMElement $address
     279     */
     280    private function streetToXML(DOMDocument $document, $prefix, DOMElement $address)
    268281    {
    269282        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),
    277286                    $this->getStreetName()
    278287                )
     
    282291
    283292    /**
    284      * @param \DOMDocument $document
     293     * @param DOMDocument $document
    285294     * @param $prefix
    286      * @param \DOMElement $address
    287      */
    288     private function localityToXML(\DOMDocument $document, $prefix, \DOMElement $address)
     295     * @param DOMElement $address
     296     */
     297    private function localityToXML(DOMDocument $document, $prefix, DOMElement $address)
    289298    {
    290299        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),
    298303                    $this->getPostalCode()
    299304                )
     
    301306        }
    302307        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),
    310311                    $this->getLocality()
    311312                )
     
    315316
    316317    /**
    317      * @param \DOMDocument $document
     318     * @param DOMDocument $document
    318319     * @param $prefix
    319      * @param \DOMElement $address
    320      */
    321     private function countryToXML(\DOMDocument $document, $prefix, \DOMElement $address)
     320     * @param DOMElement $address
     321     */
     322    private function countryToXML(DOMDocument $document, $prefix, DOMElement $address)
    322323    {
    323324        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),
    331328                    $this->getCountryCode()
    332329                )
     
    336333
    337334    /**
    338      * @param \DOMDocument $document
     335     * @param DOMDocument $document
    339336     * @param $prefix
    340      * @param \DOMElement $address
    341      */
    342     private function streetNumbersToXML(\DOMDocument $document, $prefix, \DOMElement $address)
     337     * @param DOMElement $address
     338     */
     339    private function streetNumbersToXML(DOMDocument $document, $prefix, DOMElement $address)
    343340    {
    344341        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),
    352345                    $this->getNumber()
    353346                )
     
    355348        }
    356349        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),
    364353                    $this->getBox()
    365354                )
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    67use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
     8use DOMDocument;
     9use DOMElement;
     10use SimpleXMLElement;
    711
    812/**
     
    121125    /**
    122126     * @param string $status
     127     *
    123128     * @throws BpostInvalidValueException
    124129     */
     
    162167    public function setAdditionalCustomerReference($additionalCustomerReference)
    163168    {
    164         $this->additionalCustomerReference = (string)$additionalCustomerReference;
     169        $this->additionalCustomerReference = (string) $additionalCustomerReference;
    165170    }
    166171
     
    195200     * Return the object as an array for usage in the XML
    196201     *
    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));
    209210
    210211        $this->senderToXML($document, $prefix, $box);
     
    218219
    219220    /**
    220      * @param  \SimpleXMLElement $xml
     221     * @param SimpleXMLElement $xml
    221222     *
    222223     * @return Box
     224     *
    223225     * @throws BpostInvalidValueException
    224226     * @throws BpostNotImplementedException
    225227     */
    226     public static function createFromXML(\SimpleXMLElement $xml)
     228    public static function createFromXML(SimpleXMLElement $xml)
    227229    {
    228230        $box = new Box();
     
    237239        }
    238240        if (isset($xml->nationalBox)) {
    239             /** @var \SimpleXMLElement $nationalBoxData */
     241            /** @var SimpleXMLElement $nationalBoxData */
    240242            $nationalBoxData = $xml->nationalBox->children('http://schema.post.be/shm/deepintegration/v3/national');
    241243
     
    246248            }
    247249
    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);
    256253
    257254            $box->setNationalBox($nationalBox);
    258255        }
    259256        if (isset($xml->internationalBox)) {
    260             /** @var \SimpleXMLElement $internationalBoxData */
     257            /** @var SimpleXMLElement $internationalBoxData */
    261258            $internationalBoxData = $xml->internationalBox->children('http://schema.post.be/shm/deepintegration/v3/international');
    262259
     
    264261            $className = '\\Bpost\\BpostApiClient\\Bpost\\Order\\Box\\' . ucfirst($internationalBoxData->getName());
    265262
    266             if (!method_exists($className, 'createFromXML')) {
    267                 throw new BpostNotImplementedException('No createFromXML found into ' . $className);
    268             }
     263            XmlHelper::assertMethodCreateFromXmlExists($className);
    269264
    270265            $internationalBox = call_user_func(
     
    279274        }
    280275        if (isset($xml->additionalCustomerReference) && $xml->additionalCustomerReference != '') {
    281             $box->setAdditionalCustomerReference((string)$xml->additionalCustomerReference);
     276            $box->setAdditionalCustomerReference((string) $xml->additionalCustomerReference);
    282277        }
    283278        if (!empty($xml->barcode)) {
     
    292287
    293288    /**
    294      * @param \DOMDocument $document
    295      * @param $prefix
    296      * @param \DOMElement $box
    297      */
    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)
    299294    {
    300295        if ($this->getBarcode() !== null) {
    301             $tagName = 'barcode';
    302             if ($prefix !== null) {
    303                 $tagName = $prefix . ':' . $tagName;
    304             }
    305296            $box->appendChild(
    306297                $document->createElement(
    307                     $tagName,
     298                    XmlHelper::getPrefixedTagName('barcode', $prefix),
    308299                    $this->getBarcode()
    309300                )
     
    313304
    314305    /**
    315      * @param \DOMDocument $document
    316      * @param $prefix
    317      * @param \DOMElement $box
    318      */
    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)
    320311    {
    321312        if ($this->getNationalBox() !== null) {
     
    332323
    333324    /**
    334      * @param \DOMDocument $document
    335      * @param $prefix
    336      * @param \DOMElement $box
    337      */
    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)
    339330    {
    340331        if ($this->getSender() !== null) {
     
    346337
    347338    /**
    348      * @param \DOMDocument $document
    349      * @param $prefix
    350      * @param \DOMElement $box
    351      */
    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)
    353344    {
    354345        if ($this->getRemark() !== null) {
    355             $tagName = 'remark';
    356             if ($prefix !== null) {
    357                 $tagName = $prefix . ':' . $tagName;
    358             }
    359346            $box->appendChild(
    360347                $document->createElement(
    361                     $tagName,
     348                    XmlHelper::getPrefixedTagName('remark', $prefix),
    362349                    $this->getRemark()
    363350                )
     
    367354
    368355    /**
    369      * @param \DOMDocument $document
    370      * @param $prefix
    371      * @param \DOMElement $box
    372      */
    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)
    374361    {
    375362        if ($this->getAdditionalCustomerReference() !== null) {
    376             $tagName = 'additionalCustomerReference';
    377             if ($prefix !== null) {
    378                 $tagName = $prefix . ':' . $tagName;
    379             }
    380363            $box->appendChild(
    381364                $document->createElement(
    382                     $tagName,
     365                    XmlHelper::getPrefixedTagName('additionalCustomerReference', $prefix),
    383366                    $this->getAdditionalCustomerReference()
    384367                )
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/At247.php

    r2890340 r3119293  
    77use Bpost\BpostApiClient\Bpost\Order\ParcelsDepotAddress;
    88use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product;
     9use Bpost\BpostApiClient\Common\XmlHelper;
    910use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    1011use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
     12use DOMDocument;
     13use DOMElement;
     14use SimpleXMLElement;
    1115
    1216/**
     
    1418 *
    1519 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     20 *
    1621 * @version   3.0.0
     22 *
    1723 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1824 * @license   BSD License
     
    2026class At247 extends National
    2127{
    22     /**@var string */
     28    /** @var string */
    2329    private $parcelsDepotId;
    2430
     
    134140    public function setProduct($product)
    135141    {
    136         if (! in_array($product, self::getPossibleProductValues())) {
     142        if (!in_array($product, self::getPossibleProductValues())) {
    137143            throw new BpostInvalidValueException('product', $product, self::getPossibleProductValues());
    138144        }
     
    197203    public function setRequestedDeliveryDate($requestedDeliveryDate)
    198204    {
    199         $this->requestedDeliveryDate = (string)$requestedDeliveryDate;
     205        $this->requestedDeliveryDate = (string) $requestedDeliveryDate;
    200206    }
    201207
     
    203209     * Return the object as an array for usage in the XML
    204210     *
    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));
    218220        $boxElement = parent::toXML($document, null, 'at24-7');
    219221        $nationalElement->appendChild($boxElement);
     
    268270
    269271    /**
    270      * @param \DOMDocument $document
    271      * @param \DOMElement  $typeElement
    272      * @param string       $prefix
    273      */
    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)
    275277    {
    276278        if ($this->getRequestedDeliveryDate() !== null) {
    277279            $typeElement->appendChild(
    278280                $document->createElement(
    279                     $this->getPrefixedTagName('requestedDeliveryDate', $prefix),
     281                    XmlHelper::getPrefixedTagName('requestedDeliveryDate', $prefix),
    280282                    $this->getRequestedDeliveryDate()
    281283                )
     
    285287
    286288    /**
    287      * @param \DOMDocument $document
    288      * @param \DOMElement  $typeElement
    289      * @param string       $prefix
    290      */
    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)
    292294    {
    293295        if ($this->getUnregistered() !== null) {
     
    299301
    300302    /**
    301      * @param \SimpleXMLElement $xml
    302      * @param National|null     $self
     303     * @param SimpleXMLElement $xml
     304     * @param National|null    $self
    303305     *
    304306     * @return At247
     307     *
    305308     * @throws BpostInvalidValueException
    306309     * @throws BpostNotImplementedException
     
    308311     * @throws \Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException
    309312     */
    310     public static function createFromXML(\SimpleXMLElement $xml, National $self = null)
     313    public static function createFromXML(SimpleXMLElement $xml, National $self = null)
    311314    {
    312315        $at247 = new At247();
     
    314317        if (isset($xml->{'at24-7'}->product) && $xml->{'at24-7'}->product != '') {
    315318            $at247->setProduct(
    316                 (string)$xml->{'at24-7'}->product
     319                (string) $xml->{'at24-7'}->product
    317320            );
    318321        }
    319322        if (isset($xml->{'at24-7'}->options)) {
    320             /** @var \SimpleXMLElement $optionData */
     323            /** @var SimpleXMLElement $optionData */
    321324            foreach ($xml->{'at24-7'}->options as $optionData) {
    322325                $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
     
    333336        if (isset($xml->{'at24-7'}->weight) && $xml->{'at24-7'}->weight != '') {
    334337            $at247->setWeight(
    335                 (int)$xml->{'at24-7'}->weight
     338                (int) $xml->{'at24-7'}->weight
    336339            );
    337340        }
    338341        if (isset($xml->{'at24-7'}->memberId) && $xml->{'at24-7'}->memberId != '') {
    339342            $at247->setMemberId(
    340                 (string)$xml->{'at24-7'}->memberId
     343                (string) $xml->{'at24-7'}->memberId
    341344            );
    342345        }
    343346        if (isset($xml->{'at24-7'}->receiverName) && $xml->{'at24-7'}->receiverName != '') {
    344347            $at247->setReceiverName(
    345                 (string)$xml->{'at24-7'}->receiverName
     348                (string) $xml->{'at24-7'}->receiverName
    346349            );
    347350        }
    348351        if (isset($xml->{'at24-7'}->receiverCompany) && $xml->{'at24-7'}->receiverCompany != '') {
    349352            $at247->setReceiverCompany(
    350                 (string)$xml->{'at24-7'}->receiverCompany
     353                (string) $xml->{'at24-7'}->receiverCompany
    351354            );
    352355        }
    353356        if (isset($xml->{'at24-7'}->parcelsDepotId) && $xml->{'at24-7'}->parcelsDepotId != '') {
    354357            $at247->setParcelsDepotId(
    355                 (string)$xml->{'at24-7'}->parcelsDepotId
     358                (string) $xml->{'at24-7'}->parcelsDepotId
    356359            );
    357360        }
    358361        if (isset($xml->{'at24-7'}->parcelsDepotName) && $xml->{'at24-7'}->parcelsDepotName != '') {
    359362            $at247->setParcelsDepotName(
    360                 (string)$xml->{'at24-7'}->parcelsDepotName
     363                (string) $xml->{'at24-7'}->parcelsDepotName
    361364            );
    362365        }
    363366        if (isset($xml->{'at24-7'}->parcelsDepotAddress)) {
    364             /** @var \SimpleXMLElement $parcelsDepotAddressData */
     367            /** @var SimpleXMLElement $parcelsDepotAddressData */
    365368            $parcelsDepotAddressData = $xml->{'at24-7'}->parcelsDepotAddress->children(
    366369                'http://schema.post.be/shm/deepintegration/v3/common'
     
    372375        if (isset($xml->{'at24-7'}->requestedDeliveryDate) && $xml->{'at24-7'}->requestedDeliveryDate != '') {
    373376            $at247->setRequestedDeliveryDate(
    374                 (string)$xml->{'at24-7'}->requestedDeliveryDate
     377                (string) $xml->{'at24-7'}->requestedDeliveryDate
    375378            );
    376379        }
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtBpost.php

    r2890340 r3119293  
    77use Bpost\BpostApiClient\Bpost\Order\PugoAddress;
    88use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product;
     9use Bpost\BpostApiClient\Common\XmlHelper;
    910use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    1011use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
     12use DOMDocument;
     13use DOMElement;
     14use SimpleXMLElement;
    1115
    1216/**
     
    1418 *
    1519 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     20 *
    1621 * @version   3.0.0
     22 *
    1723 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1824 * @license   BSD License
     
    4652    /**
    4753     * @param string $product Possible values are: bpack@bpost
     54     *
    4855     * @throws BpostInvalidValueException
    4956     */
     
    171178            return $this->shopHandlingInstruction->getValue();
    172179        }
     180
    173181        return null;
    174182    }
     
    185193     * Return the object as an array for usage in the XML
    186194     *
    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));
    195204        $boxElement = parent::toXML($document, null, 'atBpost');
    196205        $nationalElement->appendChild($boxElement);
     
    228237
    229238    /**
    230      * @param \DOMDocument $document
    231      * @param \DOMElement  $typeElement
    232      * @param string       $prefix
    233      */
    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)
    235244    {
    236245        if ($this->getRequestedDeliveryDate() !== null) {
     
    241250    }
    242251
    243     private function addToXmlShopHandlingInstruction(\DOMDocument $document, \DOMElement $typeElement, $prefix)
     252    private function addToXmlShopHandlingInstruction(DOMDocument $document, DOMElement $typeElement, $prefix)
    244253    {
    245254        if ($this->getShopHandlingInstruction() !== null) {
     
    251260
    252261    /**
    253      * @param \SimpleXMLElement $xml
    254      * @param National|null     $self
     262     * @param SimpleXMLElement $xml
     263     * @param National|null    $self
    255264     *
    256265     * @return AtBpost
     266     *
    257267     * @throws BpostInvalidValueException
    258268     * @throws BpostNotImplementedException
     
    260270     * @throws \Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException
    261271     */
    262     public static function createFromXML(\SimpleXMLElement $xml, National $self = null)
     272    public static function createFromXML(SimpleXMLElement $xml, National $self = null)
    263273    {
    264274        $atBpost = new AtBpost();
     
    266276        if (isset($xml->atBpost->product) && $xml->atBpost->product != '') {
    267277            $atBpost->setProduct(
    268                 (string)$xml->atBpost->product
     278                (string) $xml->atBpost->product
    269279            );
    270280        }
    271281        if (isset($xml->atBpost->options)) {
    272             /** @var \SimpleXMLElement $optionData */
     282            /** @var SimpleXMLElement $optionData */
    273283            foreach ($xml->atBpost->options as $optionData) {
    274284                $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
     
    294304        if (isset($xml->atBpost->weight) && $xml->atBpost->weight != '') {
    295305            $atBpost->setWeight(
    296                 (int)$xml->atBpost->weight
     306                (int) $xml->atBpost->weight
    297307            );
    298308        }
    299309        if (isset($xml->atBpost->receiverName) && $xml->atBpost->receiverName != '') {
    300310            $atBpost->setReceiverName(
    301                 (string)$xml->atBpost->receiverName
     311                (string) $xml->atBpost->receiverName
    302312            );
    303313        }
    304314        if (isset($xml->atBpost->receiverCompany) && $xml->atBpost->receiverCompany != '') {
    305315            $atBpost->setReceiverCompany(
    306                 (string)$xml->atBpost->receiverCompany
     316                (string) $xml->atBpost->receiverCompany
    307317            );
    308318        }
    309319        if (isset($xml->atBpost->pugoId) && $xml->atBpost->pugoId != '') {
    310320            $atBpost->setPugoId(
    311                 (string)$xml->atBpost->pugoId
     321                (string) $xml->atBpost->pugoId
    312322            );
    313323        }
    314324        if (isset($xml->atBpost->pugoName) && $xml->atBpost->pugoName != '') {
    315325            $atBpost->setPugoName(
    316                 (string)$xml->atBpost->pugoName
     326                (string) $xml->atBpost->pugoName
    317327            );
    318328        }
    319329        if (isset($xml->atBpost->pugoAddress)) {
    320             /** @var \SimpleXMLElement $pugoAddressData */
     330            /** @var SimpleXMLElement $pugoAddressData */
    321331            $pugoAddressData = $xml->atBpost->pugoAddress->children(
    322332                'http://schema.post.be/shm/deepintegration/v3/common'
     
    328338        if (isset($xml->atBpost->requestedDeliveryDate) && $xml->atBpost->requestedDeliveryDate != '') {
    329339            $atBpost->setRequestedDeliveryDate(
    330                 (string)$xml->atBpost->requestedDeliveryDate
     340                (string) $xml->atBpost->requestedDeliveryDate
    331341            );
    332342        }
    333343        if (isset($xml->atBpost->shopHandlingInstruction) && $xml->atBpost->shopHandlingInstruction != '') {
    334344            $atBpost->setShopHandlingInstruction(
    335                 (string)$xml->atBpost->shopHandlingInstruction
     345                (string) $xml->atBpost->shopHandlingInstruction
    336346            );
    337347        }
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/AtHome.php

    r2890340 r3119293  
    55use Bpost\BpostApiClient\Bpost\Order\Receiver;
    66use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product;
     7use Bpost\BpostApiClient\Common\XmlHelper;
    78use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    8 use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
    99use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
     10use DOMDocument;
     11use DOMElement;
     12use SimpleXMLElement;
    1013
    1114/**
     
    1316 *
    1417 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     18 *
    1519 * @version   3.0.0
     20 *
    1621 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1722 * @license   BSD License
     
    2732    /**
    2833     * @param string $product
     34     *
    2935     * @see getPossibleProductValues
     36     *
    3037     * @throws BpostInvalidValueException
    3138     */
     
    8289    public function setRequestedDeliveryDate($requestedDeliveryDate)
    8390    {
    84         $this->requestedDeliveryDate = (string)$requestedDeliveryDate;
     91        $this->requestedDeliveryDate = (string) $requestedDeliveryDate;
    8592    }
    8693
     
    8895     * Return the object as an array for usage in the XML
    8996     *
    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
    94102     */
    95     public function toXML(\DOMDocument $document, $prefix = null, $type = null)
     103    public function toXML(DOMDocument $document, $prefix = null, $type = null)
    96104    {
    97         $nationalElement = $document->createElement($this->getPrefixedTagName('nationalBox', $prefix));
     105        $nationalElement = $document->createElement(XmlHelper::getPrefixedTagName('nationalBox', $prefix));
    98106        $boxElement = parent::toXML($document, null, 'atHome');
    99107        $nationalElement->appendChild($boxElement);
     
    111119
    112120    /**
    113      * @param \DOMDocument $document
    114      * @param \DOMElement  $typeElement
     121     * @param DOMDocument $document
     122     * @param DOMElement  $typeElement
    115123     */
    116     protected function addToXmlRequestedDeliveryDate(\DOMDocument $document, \DOMElement $typeElement)
     124    protected function addToXmlRequestedDeliveryDate(DOMDocument $document, DOMElement $typeElement)
    117125    {
    118126        if ($this->getRequestedDeliveryDate() !== null) {
     
    127135
    128136    /**
    129      * @param \SimpleXMLElement $xml
    130      * @param National          $self
     137     * @param SimpleXMLElement $xml
     138     * @param National         $self
    131139     *
    132140     * @return AtHome
     141     *
    133142     * @throws BpostXmlInvalidItemException
    134143     * @throws \Bpost\BpostApiClient\BpostException
    135144     */
    136     public static function createFromXML(\SimpleXMLElement $xml, National $self = null)
     145    public static function createFromXML(SimpleXMLElement $xml, National $self = null)
    137146    {
    138147        if ($self === null) {
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/BpostOnAppointment.php

    r2890340 r3119293  
    44
    55use Bpost\BpostApiClient\Bpost\Order\Receiver;
     6use Bpost\BpostApiClient\Common\XmlHelper;
    67use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
     8use DOMDocument;
     9use DOMElement;
     10use SimpleXMLElement;
    711
    812/**
    913 * Class BpostOnAppointment
    10  * @package Bpost\BpostApiClient\Bpost\Order\Box
    1114 */
    1215class BpostOnAppointment extends National
     
    4750    public function setInNetworkCutOff($inNetworkCutOff)
    4851    {
    49         $this->inNetworkCutOff = (string)$inNetworkCutOff;
     52        $this->inNetworkCutOff = (string) $inNetworkCutOff;
    5053    }
    5154
     
    5356     * Return the object as an array for usage in the XML
    5457     *
    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
    5963     */
    60     public function toXML(\DOMDocument $document, $prefix = null, $type = null)
     64    public function toXML(DOMDocument $document, $prefix = null, $type = null)
    6165    {
    62         $nationalElement = $document->createElement($this->getPrefixedTagName('nationalBox', $prefix));
     66        $nationalElement = $document->createElement(XmlHelper::getPrefixedTagName('nationalBox', $prefix));
    6367        $boxElement = parent::toXML($document, null, 'bpostOnAppointment');
    6468        $nationalElement->appendChild($boxElement);
     
    7276
    7377    /**
    74      * @param \DOMDocument $document
    75      * @param \DOMElement  $typeElement
     78     * @param DOMDocument $document
     79     * @param DOMElement  $typeElement
    7680     */
    77     protected function addToXmlReceiver(\DOMDocument $document, \DOMElement $typeElement)
     81    protected function addToXmlReceiver(DOMDocument $document, DOMElement $typeElement)
    7882    {
    7983        if ($this->getReceiver() !== null) {
     
    8589
    8690    /**
    87      * @param \DOMDocument $document
    88      * @param \DOMElement  $typeElement
    89      * @param string       $prefix
     91     * @param DOMDocument $document
     92     * @param DOMElement  $typeElement
     93     * @param string      $prefix
    9094     */
    91     protected function addToXmlRequestedDeliveryDate(\DOMDocument $document, \DOMElement $typeElement, $prefix)
     95    protected function addToXmlRequestedDeliveryDate(DOMDocument $document, DOMElement $typeElement, $prefix)
    9296    {
    9397        if ($this->getInNetworkCutOff() !== null) {
    9498            $typeElement->appendChild(
    9599                $document->createElement(
    96                     $this->getPrefixedTagName('inNetworkCutOff', $prefix),
     100                    XmlHelper::getPrefixedTagName('inNetworkCutOff', $prefix),
    97101                    $this->getInNetworkCutOff()
    98102                )
     
    102106
    103107    /**
    104      * @param \SimpleXMLElement $xml
    105      * @param National|null     $self
     108     * @param SimpleXMLElement $xml
     109     * @param National|null    $self
     110     *
    106111     * @return BpostOnAppointment
     112     *
    107113     * @throws BpostXmlInvalidItemException
    108114     */
    109     public static function createFromXML(\SimpleXMLElement $xml, National $self = null)
     115    public static function createFromXML(SimpleXMLElement $xml, National $self = null)
    110116    {
    111117        $self = new self();
     
    127133        if (isset($bpostOnAppointmentXml->inNetworkCutOff) && $bpostOnAppointmentXml->inNetworkCutOff != '') {
    128134            $self->setInNetworkCutOff(
    129                 (string)$bpostOnAppointmentXml->inNetworkCutOff
     135                (string) $bpostOnAppointmentXml->inNetworkCutOff
    130136            );
    131137        }
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/CustomsInfo/CustomsInfo.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
    67use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     8use DOMDocument;
     9use DOMElement;
     10use DOMException;
     11use SimpleXMLElement;
    712
    813/**
     
    1015 *
    1116 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     17 *
    1218 * @version   3.0.0
     19 *
    1320 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1421 * @license   BSD License
     
    2633    const CUSTOM_INFO_SHIPMENT_TYPE_OTHER = 'OTHER';
    2734
     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
    2840    /**
    2941     * @var int
     
    5264
    5365    /**
     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    /**
    5487     * @param string $contentDescription
     88     *
    5589     * @throws BpostInvalidLengthException
    5690     */
     
    75109    /**
    76110     * @param string $parcelReturnInstructions
     111     *
    77112     * @throws BpostInvalidValueException
    78113     */
     
    129164
    130165    /**
    131      * @param boolean $privateAddress
     166     * @param bool $privateAddress
    132167     */
    133168    public function setPrivateAddress($privateAddress)
     
    137172
    138173    /**
    139      * @return boolean
     174     * @return bool
    140175     */
    141176    public function getPrivateAddress()
     
    146181    /**
    147182     * @param string $shipmentType
     183     *
    148184     * @throws BpostInvalidValueException
    149185     */
     
    182218
    183219    /**
     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    /**
    184267     * Return the object as an array for usage in the XML
    185268     *
    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));
    198279
    199280        $this->parcelValueToXML($document, $prefix, $customsInfo);
    200281        $this->contentDescriptionToXML($document, $prefix, $customsInfo);
    201282        $this->shipmentTypeToXML($document, $prefix, $customsInfo);
    202         $this->possibleParcelReturnInstructionValuesToXML($document, $prefix, $customsInfo);
     283        $this->parcelReturnInstructionValuesToXML($document, $prefix, $customsInfo);
    203284        $this->privateAddressToXML($document, $prefix, $customsInfo);
     285        $this->currencyToXML($document, $prefix, $customsInfo);
     286        $this->amtPostagePaidByAddresseToXML($document, $prefix, $customsInfo);
    204287
    205288        return $customsInfo;
     
    207290
    208291    /**
    209      * @param  \SimpleXMLElement $xml
     292     * @param SimpleXMLElement $xml
    210293     *
    211294     * @return CustomsInfo
     295     *
    212296     * @throws BpostInvalidLengthException
    213297     * @throws BpostInvalidValueException
    214298     */
    215     public static function createFromXML(\SimpleXMLElement $xml)
     299    public static function createFromXML(SimpleXMLElement $xml)
    216300    {
    217301        $customsInfo = new CustomsInfo();
     
    239323        if (isset($xml->privateAddress) && $xml->privateAddress != '') {
    240324            $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
    242336            );
    243337        }
     
    247341
    248342    /**
    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)
    254350    {
    255351        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),
    263355                    $this->getParcelValue()
    264356                )
     
    268360
    269361    /**
    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)
    275407    {
    276408        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),
    284412                    $this->getContentDescription()
    285413                )
     
    289417
    290418    /**
    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)
    296426    {
    297427        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),
    305431                    $this->getShipmentType()
    306432                )
     
    310436
    311437    /**
    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),
    326450                    $this->getParcelReturnInstructions()
    327451                )
     
    331455
    332456    /**
    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)
    338464    {
    339465        if ($this->getPrivateAddress() !== null) {
    340             $tagName = 'privateAddress';
    341             if ($prefix !== null) {
    342                 $tagName = $prefix . ':' . $tagName;
    343             }
    344466            if ($this->getPrivateAddress()) {
    345467                $value = 'true';
     
    349471            $customsInfo->appendChild(
    350472                $document->createElement(
    351                     $tagName,
     473                    XmlHelper::getPrefixedTagName('privateAddress', $prefix),
    352474                    $value
    353475                )
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/IBox.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box;
    44
     5use DomDocument;
     6use DomElement;
     7use SimpleXMLElement;
     8
    59/**
    610 * Interface IBox
    7  * @package Bpost\BpostApiClient\Bpost\Order\Box
    811 */
    912interface IBox
     
    3639    /**
    3740     * @remark should be implemented by the child class
     41     *
    3842     * @return array
    3943     */
     
    4246    /**
    4347     * 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
    4753     */
    48     public function toXML(\DOMDocument $document, $prefix = null);
     54    public function toXML(DOMDocument $document, $prefix = null);
    4955
    5056    /**
    51      * @param  \SimpleXMLElement $xml
     57     * @param SimpleXMLElement $xml
     58     *
    5259     * @return self
    5360     */
    54     public static function createFromXML(\SimpleXMLElement $xml);
     61    public static function createFromXML(SimpleXMLElement $xml);
    5562}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/International.php

    r2890340 r3119293  
    44
    55use Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo;
     6use Bpost\BpostApiClient\Bpost\Order\Box\International\ParcelContent;
    67use Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging;
    78use Bpost\BpostApiClient\Bpost\Order\Box\Option\Option;
    89use Bpost\BpostApiClient\Bpost\Order\Receiver;
    910use Bpost\BpostApiClient\Bpost\ProductConfiguration\Product;
     11use Bpost\BpostApiClient\Common\XmlHelper;
     12use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
    1013use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    1114use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
     15use DomDocument;
     16use DomElement;
     17use DOMException;
     18use SimpleXMLElement;
    1219
    1320/**
     
    1522 *
    1623 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     24 *
    1725 * @version   3.0.0
     26 *
    1827 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1928 * @license   BSD License
     
    2433     * @var string
    2534     */
    26     private $product;
     35    protected $product;
    2736
    2837    /**
    2938     * @var array
    3039     */
    31     private $options;
    32 
    33     /**
    34      * @var \Bpost\BpostApiClient\Bpost\Order\Receiver
     40    private $options = array();
     41
     42    /**
     43     * @var Receiver
    3544     */
    3645    private $receiver;
     
    4251
    4352    /**
    44      * @var \Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo
     53     * @var CustomsInfo
    4554     */
    4655    private $customsInfo;
    4756
    4857    /**
    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
    5067     */
    5168    public function setCustomsInfo($customsInfo)
     
    5572
    5673    /**
    57      * @return \Bpost\BpostApiClient\Bpost\Order\Box\CustomsInfo\CustomsInfo
     74     * @return CustomsInfo
    5875     */
    5976    public function getCustomsInfo()
     
    104121    /**
    105122     * @param string $product
     123     *
    106124     * @throws BpostInvalidValueException
    107125     */
     
    133151            Product::PRODUCT_NAME_BPACK_WORLD_EXPRESS_PRO,
    134152            Product::PRODUCT_NAME_BPACK_EUROPE_BUSINESS,
     153            Product::PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL,
    135154        );
    136155    }
    137156
    138157    /**
    139      * @param \Bpost\BpostApiClient\Bpost\Order\Receiver $receiver
     158     * @param Receiver $receiver
    140159     */
    141160    public function setReceiver($receiver)
     
    145164
    146165    /**
    147      * @return \Bpost\BpostApiClient\Bpost\Order\Receiver
     166     * @return Receiver
    148167     */
    149168    public function getReceiver()
     
    153172
    154173    /**
     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    /**
    155211     * Return the object as an array for usage in the XML
    156212     *
    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));
    170225        $internationalBox->appendChild($international);
    171226
    172227        if ($this->getProduct() !== null) {
    173228            $international->appendChild(
    174                 $document->createElement(
    175                     'international:product',
    176                     $this->getProduct()
    177                 )
     229                $document->createElement(XmlHelper::getPrefixedTagName('product', $prefix), $this->getProduct())
    178230            );
    179231        }
     
    181233        $options = $this->getOptions();
    182234        if (!empty($options)) {
    183             $optionsElement = $document->createElement('international:options');
     235            $optionsElement = $document->createElement(XmlHelper::getPrefixedTagName('options', $prefix));
    184236            foreach ($options as $option) {
    185237                $optionsElement->appendChild(
    186                     $option->toXML($document)
     238                    $option->toXML($document, 'common')
    187239                );
    188240            }
     
    192244        if ($this->getReceiver() !== null) {
    193245            $international->appendChild(
    194                 $this->getReceiver()->toXML($document, 'international')
     246                $this->getReceiver()->toXML($document, $prefix)
    195247            );
    196248        }
     
    199251            $international->appendChild(
    200252                $document->createElement(
    201                     'international:parcelWeight',
     253                    XmlHelper::getPrefixedTagName('parcelWeight', $prefix),
    202254                    $this->getParcelWeight()
    203255                )
     
    207259        if ($this->getCustomsInfo() !== null) {
    208260            $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);
    211273        }
    212274
     
    215277
    216278    /**
    217      * @param  \SimpleXMLElement $xml
     279     * @param SimpleXMLElement $xml
    218280     *
    219281     * @return International
     282     *
     283     * @throws BpostInvalidLengthException
    220284     * @throws BpostInvalidValueException
    221285     * @throws BpostNotImplementedException
    222286     */
    223     public static function createFromXML(\SimpleXMLElement $xml)
     287    public static function createFromXML(SimpleXMLElement $xml)
    224288    {
    225289        $international = new International();
     
    231295        }
    232296        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                        );
    248314                }
    249315
     
    269335            );
    270336        }
     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        }
    271345
    272346        return $international;
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National.php

    r2890340 r3119293  
    88use Bpost\BpostApiClient\BpostException;
    99use Bpost\BpostApiClient\Common\ComplexAttribute;
     10use Bpost\BpostApiClient\Common\XmlHelper;
     11use Bpost\BpostApiClient\Exception\BpostNotImplementedException;
    1012use Bpost\BpostApiClient\Exception\XmlException\BpostXmlInvalidItemException;
     13use DomDocument;
     14use DomElement;
     15use SimpleXMLElement;
    1116
    1217/**
     
    1419 *
    1520 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     21 *
    1622 * @version   3.0.0
     23 *
    1724 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1825 * @license   BSD License
     
    7784    /**
    7885     * @remark should be implemented by the child class
     86     *
    7987     * @return array
    8088     */
     
    143151     * Return the object as an array for usage in the XML
    144152     *
    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)
    151160    {
    152161        $typeElement = $document->createElement($type);
    153162
    154163        if ($this->getProduct() !== null) {
    155             $tagName = 'product';
    156             if ($prefix !== null) {
    157                 $tagName = $prefix . ':' . $tagName;
    158             }
    159164            $typeElement->appendChild(
    160165                $document->createElement(
    161                     $tagName,
     166                    XmlHelper::getPrefixedTagName('product', $prefix),
    162167                    $this->getProduct()
    163168                )
     
    178183        if ($this->getWeight() !== null) {
    179184            $typeElement->appendChild(
    180                 $document->createElement($this->getPrefixedTagName('weight', $prefix), $this->getWeight())
     185                $document->createElement(XmlHelper::getPrefixedTagName('weight', $prefix), $this->getWeight())
    181186            );
    182187        }
     
    197202            $typeElement->appendChild(
    198203                $document->createElement(
    199                     $this->getPrefixedTagName('desiredDeliveryPlace', $prefix),
     204                    XmlHelper::getPrefixedTagName('desiredDeliveryPlace', $prefix),
    200205                    $this->getDesiredDeliveryPlace()
    201206                )
     
    206211    }
    207212
    208 
    209     /**
    210      * @param \SimpleXMLElement $nationalXml
    211      * @param National          $self
     213    /**
     214     * @param SimpleXMLElement $nationalXml
     215     * @param National         $self
     216     *
    212217     * @return AtHome
     218     *
    213219     * @throws BpostException
    214220     * @throws BpostXmlInvalidItemException
    215221     */
    216     public static function createFromXML(\SimpleXMLElement $nationalXml, National $self = null)
     222    public static function createFromXML(SimpleXMLElement $nationalXml, National $self = null)
    217223    {
    218224        if ($self === null) {
     
    222228        if (isset($nationalXml->product) && $nationalXml->product != '') {
    223229            $self->setProduct(
    224                 (string)$nationalXml->product
     230                (string) $nationalXml->product
    225231            );
    226232        }
    227233
    228234        if (isset($nationalXml->options) && !empty($nationalXml->options)) {
    229             /** @var \SimpleXMLElement $optionData */
     235            /** @var SimpleXMLElement $optionData */
    230236            foreach ($nationalXml->options as $optionData) {
    231237                $optionData = $optionData->children('http://schema.post.be/shm/deepintegration/v3/common');
     
    249255        if (isset($nationalXml->weight) && $nationalXml->weight != '') {
    250256            $self->setWeight(
    251                 (int)$nationalXml->weight
     257                (int) $nationalXml->weight
    252258            );
    253259        }
     
    255261        if (isset($nationalXml->openingHours) && $nationalXml->openingHours != '') {
    256262            foreach ($nationalXml->openingHours->children() as $day => $value) {
    257                 $self->addOpeningHour(new Day($day, (string)$value));
     263                $self->addOpeningHour(new Day($day, (string) $value));
    258264            }
    259265        }
     
    261267        if (isset($nationalXml->desiredDeliveryPlace) && $nationalXml->desiredDeliveryPlace != '') {
    262268            $self->setDesiredDeliveryPlace(
    263                 (string)$nationalXml->desiredDeliveryPlace
     269                (string) $nationalXml->desiredDeliveryPlace
    264270            );
    265271        }
     
    269275
    270276    /**
    271      * @param \SimpleXMLElement $optionData
     277     * @param SimpleXMLElement $optionData
    272278     *
    273279     * @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);
    289287
    290288        return call_user_func(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National/ParcelLockerReducedMobilityZone.php

    r2890340 r3119293  
    44
    55use Bpost\BpostApiClient\Common\ComplexAttribute;
     6use Bpost\BpostApiClient\Common\XmlHelper;
     7use DOMDocument;
     8use DOMElement;
     9use SimpleXMLElement;
    610
    711class ParcelLockerReducedMobilityZone extends ComplexAttribute
    812{
    913    /**
    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
    1419     */
    15     public function toXml(\DOMDocument $document, $prefix = null, $type = null)
     20    public function toXml(DOMDocument $document, $prefix = null, $type = null)
    1621    {
    17         $tagName = $this->getPrefixedTagName('parcelLockerReducedMobilityZone', $prefix);
     22        $tagName = XmlHelper::getPrefixedTagName('parcelLockerReducedMobilityZone', $prefix);
    1823
    1924        $xml = $document->createElement($tagName);
     
    2429    /**
    2530     * @todo Implement it, because today, nothing is specified
    26      * @param \SimpleXMLElement $xml
     31     *
     32     * @param SimpleXMLElement $xml
     33     *
    2734     * @return ParcelLockerReducedMobilityZone|ComplexAttribute
    2835     */
    29     public static function createFromXml(\SimpleXMLElement $xml)
     36    public static function createFromXml(SimpleXMLElement $xml)
    3037    {
    3138        $self = new self();
     39
    3240        return $self;
    3341    }
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/National/Unregistered.php

    r2890340 r3119293  
    77use Bpost\BpostApiClient\Common\BasicAttribute\PhoneNumber;
    88use Bpost\BpostApiClient\Common\ComplexAttribute;
     9use Bpost\BpostApiClient\Common\XmlHelper;
     10use DOMDocument;
     11use DOMElement;
     12use SimpleXMLElement;
    913
    1014class Unregistered extends ComplexAttribute
     
    119123
    120124    /**
    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
    125130     */
    126     public function toXml(\DOMDocument $document, $prefix = null, $type = null)
     131    public function toXml(DOMDocument $document, $prefix = null, $type = null)
    127132    {
    128         $tagName = $this->getPrefixedTagName('unregistered', $prefix);
     133        $tagName = XmlHelper::getPrefixedTagName('unregistered', $prefix);
    129134
    130135        $xml = $document->createElement($tagName);
    131136
    132137        if ($this->hasLanguage()) {
    133             $tagName = $this->getPrefixedTagName('language', $prefix);
     138            $tagName = XmlHelper::getPrefixedTagName('language', $prefix);
    134139            $xml->appendChild($document->createElement($tagName, $this->getLanguage()));
    135140        }
    136141
    137142        if ($this->getMobilePhone() !== null) {
    138             $tagName = $this->getPrefixedTagName('mobilePhone', $prefix);
     143            $tagName = XmlHelper::getPrefixedTagName('mobilePhone', $prefix);
    139144            $xml->appendChild($document->createElement($tagName, $this->getMobilePhone()));
    140145        }
    141146
    142147        if ($this->getEmailAddress() !== null) {
    143             $tagName = $this->getPrefixedTagName('emailAddress', $prefix);
     148            $tagName = XmlHelper::getPrefixedTagName('emailAddress', $prefix);
    144149            $xml->appendChild($document->createElement($tagName, $this->getEmailAddress()));
    145150        }
     
    155160
    156161    /**
    157      * @param \SimpleXMLElement $xml
     162     * @param SimpleXMLElement $xml
     163     *
    158164     * @return Unregistered
    159165     */
    160     public static function createFromXml(\SimpleXMLElement $xml)
     166    public static function createFromXml(SimpleXMLElement $xml)
    161167    {
    162168        $self = new self();
    163169
    164170        if (isset($xml->language) && $xml->language != '') {
    165             $self->setLanguage((string)$xml->language);
     171            $self->setLanguage((string) $xml->language);
    166172        }
    167173
    168174        if (isset($xml->mobilePhone) && $xml->mobilePhone != '') {
    169             $self->setMobilePhone((string)$xml->mobilePhone);
     175            $self->setMobilePhone((string) $xml->mobilePhone);
    170176        }
    171177
    172178        if (isset($xml->emailAddress) && $xml->emailAddress != '') {
    173             $self->setEmailAddress((string)$xml->emailAddress);
     179            $self->setEmailAddress((string) $xml->emailAddress);
    174180        }
    175181
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/OpeningHour/Day.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\OpeningHour;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     7use DomDocument;
     8use DomElement;
    69
    710/**
     
    912 *
    1013 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     14 *
    1115 * @version   3.0.0
     16 *
    1217 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1318 * @license   BSD License
     
    3540    /**
    3641     * @param string $day
     42     *
    3743     * @throws BpostInvalidValueException
    3844     */
     
    101107     * Return the object as an array for usage in the XML
    102108     *
    103      * @param  \DomDocument $document
    104      * @param  string       $prefix
    105      * @return \DomElement
     109     * @param DomDocument $document
     110     * @param string      $prefix
     111     *
     112     * @return DomElement
    106113     */
    107     public function toXML(\DOMDocument $document, $prefix = null)
     114    public function toXML(DOMDocument $document, $prefix = null)
    108115    {
    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        );
    115120    }
    116121}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/AutomaticSecondPresentation.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
     4
     5use Bpost\BpostApiClient\Common\XmlHelper;
     6use DomDocument;
     7use DomElement;
     8use SimpleXMLElement;
    49
    510/**
     
    712 *
    813 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     14 *
    915 * @version   3.0.0
     16 *
    1017 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1118 * @license   BSD License
     
    1623     * Return the object as an array for usage in the XML
    1724     *
    18      * @param  \DomDocument $document
    19      * @param  string       $prefix
    20      * @return \DomElement
     25     * @param DomDocument $document
     26     * @param string      $prefix
     27     *
     28     * @return DomElement
    2129     */
    22     public function toXML(\DOMDocument $document, $prefix = null)
     30    public function toXML(DOMDocument $document, $prefix = 'common')
    2331    {
    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));
    3033    }
    3134
    3235    /**
    33      * @param \SimpleXMLElement $xml
     36     * @param SimpleXMLElement $xml
    3437     *
    3538     * @return static
    3639     */
    37     public static function createFromXML(\SimpleXMLElement $xml)
     40    public static function createFromXML(SimpleXMLElement $xml)
    3841    {
    3942        return new static();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/CashOnDelivery.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
     4
     5use Bpost\BpostApiClient\Common\XmlHelper;
     6use DomDocument;
     7use DomElement;
    48
    59/**
     
    711 *
    812 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     13 *
    914 * @version   3.0.0
     15 *
    1016 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1117 * @license   BSD License
     
    9197     * Return the object as an array for usage in the XML
    9298     *
    93      * @param  \DomDocument $document
    94      * @param  string       $prefix
    95      * @return \DomElement
     99     * @param DomDocument $document
     100     * @param string      $prefix
     101     *
     102     * @return DomElement
    96103     */
    97     public function toXML(\DOMDocument $document, $prefix = 'common')
     104    public function toXML(DOMDocument $document, $prefix = 'common')
    98105    {
    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));
    105107
    106108        if ($this->getAmount() !== null) {
    107             $tagName = 'codAmount';
    108             if ($prefix !== null) {
    109                 $tagName = $prefix . ':' . $tagName;
    110             }
    111109            $cod->appendChild(
    112110                $document->createElement(
    113                     $tagName,
     111                    XmlHelper::getPrefixedTagName('codAmount', $prefix),
    114112                    $this->getAmount()
    115113                )
     
    117115        }
    118116        if ($this->getIban() !== null) {
    119             $tagName = 'iban';
    120             if ($prefix !== null) {
    121                 $tagName = $prefix . ':' . $tagName;
    122             }
    123117            $cod->appendChild(
    124118                $document->createElement(
    125                     $tagName,
     119                    XmlHelper::getPrefixedTagName('iban', $prefix),
    126120                    $this->getIban()
    127121                )
     
    129123        }
    130124        if ($this->getBic() !== null) {
    131             $tagName = 'bic';
    132             if ($prefix !== null) {
    133                 $tagName = $prefix . ':' . $tagName;
    134             }
    135125            $cod->appendChild(
    136126                $document->createElement(
    137                     $tagName,
     127                    XmlHelper::getPrefixedTagName('bic', $prefix),
    138128                    $this->getBic()
    139129                )
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Insurance.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
    44
    5 use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
    6 
    75/**
    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
    148 */
    15 class Insurance extends Option
     9class Insurance extends Insured
    1610{
    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 string
    33      */
    34     private $type;
    35 
    36     /**
    37      * @var string
    38      */
    39     private $value;
    40 
    41     /**
    42      * @return array
    43      */
    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 $type
    54      * @throws BpostInvalidValueException
    55      */
    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 string
    67      */
    68     public function getType()
    69     {
    70         return $this->type;
    71     }
    72 
    73     /**
    74      * @param string $value
    75      * @throws BpostInvalidValueException
    76      */
    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 string
    88      */
    89     public function getValue()
    90     {
    91         return $this->value;
    92     }
    93 
    94     /**
    95      * @return array
    96      */
    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      $type
    115      * @param string|null $value
    116      *
    117      * @throws BpostInvalidValueException
    118      */
    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 XML
    129      *
    130      * @param  \DomDocument $document
    131      * @param  string       $prefix
    132      * @return \DomElement
    133      */
    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 $xml
    158      *
    159      * @return static
    160      */
    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     }
    18211}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Messaging.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
    67use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidValueException;
     8use DomDocument;
     9use DomElement;
     10use SimpleXMLElement;
    711
    812/**
     
    1014 *
    1115 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     16 *
    1217 * @version   3.0.0
     18 *
    1319 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1420 * @license   BSD License
     
    4854    /**
    4955     * @param string $emailAddress
     56     *
    5057     * @throws BpostInvalidLengthException
    5158     */
     
    7077    /**
    7178     * @param string $language
     79     *
    7280     * @throws BpostInvalidValueException
    7381     */
     
    106114    /**
    107115     * @param string $mobilePhone
     116     *
    108117     * @throws BpostInvalidLengthException
    109118     */
     
    141150    /**
    142151     * @param string $type
     152     *
    143153     * @throws BpostInvalidValueException
    144154     */
     
    161171
    162172    /**
    163      * @param string $type
    164      * @param string $language
     173     * @param string      $type
     174     * @param string      $language
    165175     * @param string|null $emailAddress
    166176     * @param string|null $mobilePhone
     
    185195     * Return the object as an array for usage in the XML
    186196     *
    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));
    199205        $messaging->setAttribute('language', $this->getLanguage());
    200206
    201207        if ($this->getEmailAddress() !== null) {
    202             $tagName = 'emailAddress';
    203             if ($prefix !== null) {
    204                 $tagName = $prefix . ':' . $tagName;
    205             }
    206208            $messaging->appendChild(
    207209                $document->createElement(
    208                     $tagName,
     210                    XmlHelper::getPrefixedTagName('emailAddress', $prefix),
    209211                    $this->getEmailAddress()
    210212                )
     
    212214        }
    213215        if ($this->getMobilePhone() !== null) {
    214             $tagName = 'mobilePhone';
    215             if ($prefix !== null) {
    216                 $tagName = $prefix . ':' . $tagName;
    217             }
    218216            $messaging->appendChild(
    219217                $document->createElement(
    220                     $tagName,
     218                    XmlHelper::getPrefixedTagName('mobilePhone', $prefix),
    221219                    $this->getMobilePhone()
    222220                )
     
    228226
    229227    /**
    230      * @param  \SimpleXMLElement $xml
     228     * @param SimpleXMLElement $xml
    231229     *
    232230     * @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)
    236236    {
    237237        $messaging = new Messaging($xml->getName(), (string) $xml->attributes()->language);
    238238
    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);
    245245        }
    246246
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Option.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
     4
     5use DOMDocument;
     6use DOMElement;
    47
    58/**
     
    710 *
    811 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     12 *
    913 * @version   3.0.0
     14 *
    1015 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1116 * @license   BSD License
     
    1419{
    1520    /**
    16      * @param \DOMDocument $document
    17      * @param string       $prefix
    18      * @return \DOMElement
     21     * @param DOMDocument $document
     22     * @param string      $prefix
     23     *
     24     * @return DOMElement
    1925     */
    20     abstract public function toXML(\DOMDocument $document, $prefix = null);
     26    abstract public function toXML(DOMDocument $document, $prefix = null);
    2127}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/SaturdayDelivery.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use DOMDocument;
    67use DomElement;
     
    1011 *
    1112 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     13 *
    1214 * @version   3.0.0
     15 *
    1316 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1417 * @license   BSD License
     
    1922     * Return the object as an array for usage in the XML
    2023     *
    21      * @param  DomDocument $document
    22      * @param  string      $prefix
     24     * @param DomDocument $document
     25     * @param string      $prefix
     26     *
    2327     * @return DomElement
    2428     */
    2529    public function toXML(DOMDocument $document, $prefix = 'common')
    2630    {
    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));
    3332    }
    3433}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Box/Option/Signature.php

    r2890340 r3119293  
    44
    55/**
    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
    128 */
    13 class Signature extends Option
     9class Signature extends Signed
    1410{
    15     /**
    16      * Return the object as an array for usage in the XML
    17      *
    18      * @param  \DomDocument $document
    19      * @param  string       $prefix
    20      * @return \DomElement
    21      */
    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     }
    3111}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Customer.php

    r2890340 r3119293  
    33namespace Bpost\BpostApiClient\Bpost\Order;
    44
     5use Bpost\BpostApiClient\Common\XmlHelper;
    56use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
     7use DomDocument;
     8use DomElement;
     9use SimpleXMLElement;
    610
    711/**
     
    7377    /**
    7478     * @param string $emailAddress
     79     *
    7580     * @throws BpostInvalidLengthException
    7681     */
     
    110115    /**
    111116     * @param string $phoneNumber
     117     *
    112118     * @throws BpostInvalidLengthException
    113119     */
     
    132138     * Return the object as an array for usage in the XML
    133139     *
    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));
    146148
    147149        if ($this->getName() !== null) {
     
    187189
    188190    /**
    189      * @param  \SimpleXMLElement $xml
    190      * @param  Customer          $instance
     191     * @param SimpleXMLElement $xml
     192     * @param Customer         $instance
    191193     *
    192194     * @return Customer
     195     *
    193196     * @throws BpostInvalidLengthException
    194197     */
    195     public static function createFromXMLHelper(\SimpleXMLElement $xml, Customer $instance)
     198    public static function createFromXMLHelper(SimpleXMLElement $xml, Customer $instance)
    196199    {
    197200        if (isset($xml->name) && $xml->name != '') {
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Line.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order;
     4
     5use Bpost\BpostApiClient\Common\XmlHelper;
     6use DomDocument;
     7use DOMElement;
     8use SimpleXMLElement;
    49
    510/**
     
    6974     * Return the object as an array for usage in the XML
    7075     *
    71      * @param  \DomDocument $document
    72      * @param  string       $prefix
    73      * @return \DOMElement
     76     * @param DomDocument $document
     77     * @param string      $prefix
     78     *
     79     * @return DOMElement
    7480     */
    75     public function toXML(\DomDocument $document, $prefix = null)
     81    public function toXML(DOMDocument $document, $prefix = null)
    7682    {
    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));
    8384
    8485        if ($this->getText() !== null) {
    85             $tagName = 'text';
    86             if ($prefix !== null) {
    87                 $tagName = $prefix . ':' . $tagName;
    88             }
    8986            $line->appendChild(
    9087                $document->createElement(
    91                     $tagName,
     88                    XmlHelper::getPrefixedTagName('text', $prefix),
    9289                    $this->getText()
    9390                )
     
    9592        }
    9693        if ($this->getNumberOfItems() !== null) {
    97             $tagName = 'nbOfItems';
    98             if ($prefix !== null) {
    99                 $tagName = $prefix . ':' . $tagName;
    100             }
    10194            $line->appendChild(
    10295                $document->createElement(
    103                     $tagName,
     96                    XmlHelper::getPrefixedTagName('nbOfItems', $prefix),
    10497                    $this->getNumberOfItems()
    10598                )
     
    111104
    112105    /**
    113      * @param  \SimpleXMLElement $xml
     106     * @param SimpleXMLElement $xml
     107     *
    114108     * @return Line
    115109     */
    116     public static function createFromXML(\SimpleXMLElement $xml)
     110    public static function createFromXML(SimpleXMLElement $xml)
    117111    {
    118112        $line = new Line();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/ParcelsDepotAddress.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order;
     4
     5use SimpleXMLElement;
    46
    57/**
     
    1315
    1416    /**
    15      * @param \SimpleXMLElement $xml
     17     * @param SimpleXMLElement $xml
     18     *
    1619     * @return ParcelsDepotAddress
    1720     */
    18     public static function createFromXML(\SimpleXMLElement $xml)
     21    public static function createFromXML(SimpleXMLElement $xml)
    1922    {
    2023        return parent::createFromXML($xml);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/PugoAddress.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order;
     4
     5use SimpleXMLElement;
    46
    57/**
     
    1315
    1416    /**
    15      * @param \SimpleXMLElement $xml
     17     * @param SimpleXMLElement $xml
     18     *
    1619     * @return PugoAddress
    1720     */
    18     public static function createFromXML(\SimpleXMLElement $xml)
     21    public static function createFromXML(SimpleXMLElement $xml)
    1922    {
    2023        return parent::createFromXML($xml);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Receiver.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order;
     4
     5use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidLengthException;
     6use SimpleXMLElement;
    47
    58/**
     
    1316
    1417    /**
    15      * @param  \SimpleXMLElement $xml
     18     * @param SimpleXMLElement $xml
     19     *
    1620     * @return Receiver
     21     *
     22     * @throws BpostInvalidLengthException
    1723     */
    18     public static function createFromXML(\SimpleXMLElement $xml)
     24    public static function createFromXML(SimpleXMLElement $xml)
    1925    {
    20         $receiver = new Receiver();
    21         $receiver = parent::createFromXMLHelper($xml, $receiver);
     26        /** @var Receiver $receiver */
     27        $receiver = parent::createFromXMLHelper($xml, new Receiver());
    2228
    2329        return $receiver;
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/Order/Sender.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient\Bpost\Order;
     4
     5use SimpleXMLElement;
    46
    57/**
     
    1315
    1416    /**
    15      * @param  \SimpleXMLElement $xml
     17     * @param SimpleXMLElement $xml
     18     *
    1619     * @return Sender
    1720     */
    18     public static function createFromXML(\SimpleXMLElement $xml)
     21    public static function createFromXML(SimpleXMLElement $xml)
    1922    {
    20         $sender = new Sender();
    21         $sender = parent::createFromXMLHelper($xml, $sender);
     23        /** @var Sender $sender */
     24        $sender = parent::createFromXMLHelper($xml, new Sender());
    2225
    2326        return $sender;
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration.php

    r2890340 r3119293  
    88/**
    99 * Class ProductConfiguration
    10  * @package Bpost\BpostApiClient\Bpost
    1110 */
    1211class ProductConfiguration
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Characteristic.php

    r2890340 r3119293  
    77/**
    88 * Class Characteristic
    9  * @package Bpost\BpostApiClient\Bpost\ProductConfiguration
    109 */
    1110class Characteristic
    1211{
    13     /** @var  string */
     12    /** @var string */
    1413    private $displayValue;
    15     /** @var  int */
     14    /** @var int */
    1615    private $value;
    17     /** @var  string */
     16    /** @var string */
    1817    private $name;
    1918
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/DeliveryMethod.php

    r2890340 r3119293  
    77/**
    88 * Class DeliveryMethod
    9  * @package Bpost\BpostApiClient\Bpost\ProductConfiguration
    109 */
    1110class DeliveryMethod
     
    2019    const DELIVERY_METHOD_VISIBILITY_INVISIBLE = 'INVISIBLE';
    2120
    22     /** @var  string */
     21    /** @var string */
    2322    private $name;
    24     /** @var  string */
     23    /** @var string */
    2524    private $visibility;
    2625    /** @var Product[] */
     
    6665    public function setName($name)
    6766    {
    68         $this->name = (string)$name;
     67        $this->name = (string) $name;
    6968    }
    7069
    7170    /**
    7271     * @return string
     72     *
    7373     * @see Constants self::VISIBLITY_*
    7474     */
     
    9393    public function setVisibility($visibility)
    9494    {
    95         $this->visibility = (string)$visibility;
     95        $this->visibility = (string) $visibility;
    9696    }
    9797
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Option.php

    r2890340 r3119293  
    77/**
    88 * Class Option
    9  * @package Bpost\BpostApiClient\Bpost\ProductConfiguration
    109 */
    1110class Option
     
    1514    const OPTION_VISIBILITY_VISIBLE_BY_CONSUMER_AND_MANDATORY = 'VISIBLE_BY_CONSUMER_AND_MANDATORY';
    1615
    17     /** @var  string */
     16    /** @var string */
    1817    private $visibility;
    19     /** @var  int */
     18    /** @var int */
    2019    private $price;
    21     /** @var  string */
     20    /** @var string */
    2221    private $name;
    2322    /** @var Characteristic[] */
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Price.php

    r2890340 r3119293  
    88/**
    99 * Class Price
    10  * @package Bpost\BpostApiClient\Bpost\ProductConfiguration
    1110 */
    1211class Price
    1312{
    14     /** @var  string */
     13    /** @var string */
    1514    private $countryIso2;
    1615
    17     /** @var  int */
     16    /** @var int */
    1817    private $priceLessThan2;
    19     /** @var  int */
     18    /** @var int */
    2019    private $price2To5;
    21     /** @var  int */
     20    /** @var int */
    2221    private $price5To10;
    23     /** @var  int */
     22    /** @var int */
    2423    private $price10To20;
    25     /** @var  int */
     24    /** @var int */
    2625    private $price20To30;
    2726
     
    5352     *
    5453     * @return int
     54     *
    5555     * @throws BpostInvalidWeightException
    5656     */
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Product.php

    r1467688 r3119293  
    77/**
    88 * Class Product
    9  * @package Bpost\BpostApiClient\Bpost\ProductConfiguration
    109 */
    1110class Product
     
    2322    const PRODUCT_NAME_BPACK_WORLD_BUSINESS = 'bpack World Business';
    2423    const PRODUCT_NAME_BPACK_EUROPE_BUSINESS = 'bpack Europe Business';
     24    const PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL = 'bpack@bpost international';
    2525
    26     /** @var  bool */
     26    /** @var bool */
    2727    private $default;
    28     /** @var  string */
     28    /** @var string */
    2929    private $name;
    3030
    31     /** @var  Price[] */
     31    /** @var Price[] */
    3232    private $prices = array();
    33     /** @var  Option[] */
     33    /** @var Option[] */
    3434    private $options = array();
    3535
     
    6666            }
    6767        }
     68
    6869        return $product;
    6970    }
     
    151152            case self::PRODUCT_NAME_BPACK_WORLD_BUSINESS:
    152153            case self::PRODUCT_NAME_BPACK_EUROPE_BUSINESS:
     154            case self::PRODUCT_NAME_BPACK_AT_BPOST_INTERNATIONAL:
    153155            default:
    154156                return false;
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Bpost/ProductConfiguration/Visibility.php

    r1467688 r3119293  
    55/**
    66 * Class Visibility
    7  * @package Bpost\BpostApiClient\Bpost\ProductConfiguration
    87 */
    98class Visibility
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/BpostException.php

    r2890340 r3119293  
    22
    33namespace Bpost\BpostApiClient;
     4
     5use Exception;
    46
    57/**
     
    810 * @author Tijs Verkoyen <php-bpost@verkoyen.eu>
    911 */
    10 class BpostException extends \Exception
     12class BpostException extends Exception
    1113{
    1214}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/BasicAttribute.php

    r2890340 r3119293  
    1818    /**
    1919     * BasicAttribute constructor.
     20     *
    2021     * @param mixed  $value
    2122     * @param string $key
     
    4142    private function setKey($key)
    4243    {
    43         $this->key = (string)($key ?: $this->getDefaultKey());
     44        $this->key = (string) ($key ?: $this->getDefaultKey());
    4445    }
    4546
     
    5758    public function __toString()
    5859    {
    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();
    7461    }
    7562
    7663    /**
    7764     * @param int $length
     65     *
    7866     * @throws BpostInvalidLengthException
    7967     */
     
    8775    /**
    8876     * @param array $allowedValues
     77     *
    8978     * @throws BpostInvalidValueException
    9079     */
     
    9887    /**
    9988     * @param string $regexPattern
     89     *
    10090     * @throws BpostInvalidPatternException
    10191     */
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/ComplexAttribute.php

    r1467688 r3119293  
    55abstract class ComplexAttribute
    66{
    7     /**
    8      * Prefix $tagName with the $prefix, if needed
    9      * @param string $prefix
    10      * @param string $tagName
    11      * @return string
    12      */
    13     public function getPrefixedTagName($tagName, $prefix = null)
    14     {
    15         if (empty($prefix)) {
    16             return $tagName;
    17         }
    18         return $prefix . ':' . $tagName;
    19     }
    207}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/IAttribute.php

    r2021946 r3119293  
    33namespace Bpost\BpostApiClient\Common;
    44
     5use DOMDocument;
     6use DOMElement;
     7use SimpleXMLElement;
     8
    59interface IAttribute
    610{
    711    /**
    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
    1217     */
    13     public function toXml(\DOMDocument $document, $prefix = null, $type = null);
     18    public function toXml(DOMDocument $document, $prefix = null, $type = null);
    1419
    1520    /**
    16      * @param \SimpleXMLElement $xml
     21     * @param SimpleXMLElement $xml
     22     *
    1723     * @return IAttribute
    1824     */
    19     public static function createFromXml(\SimpleXMLElement $xml);
     25    public static function createFromXml(SimpleXMLElement $xml);
    2026}
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Common/ValidatedValue.php

    r2890340 r3119293  
    1818    /**
    1919     * ValidatedValue constructor.
     20     *
    2021     * @param mixed $value
    2122     */
     
    4748    public function __toString()
    4849    {
    49         return (string)$this->getValue();
     50        return (string) $this->getValue();
    5051    }
    5152
    5253    /**
    5354     * @param int $length
     55     *
    5456     * @throws BpostInvalidLengthException
    5557     */
     
    6365    /**
    6466     * @param array $allowedValues
     67     *
    6568     * @throws BpostInvalidValueException
    6669     */
     
    7477    /**
    7578     * @param string $regexPattern
     79     *
    7680     * @throws BpostInvalidPatternException
    7781     */
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostApiResponseException
    9  * @package Bpost\BpostApiClient\Exception
    109 */
    1110class BpostApiResponseException extends BpostException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostApiBusinessException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostApiBusinessException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    109 */
    1110class BpostApiBusinessException extends BpostApiResponseException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostApiSystemException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostApiSystemException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    109 */
    1110class BpostApiSystemException extends BpostApiResponseException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostCurlException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostCurlException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    109 */
    1110class BpostCurlException extends BpostApiResponseException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidResponseException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostApiResponseException;
     6use Exception;
    67
    78/**
    89 * Class BpostInvalidResponseException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    1010 */
    1111class BpostInvalidResponseException extends BpostApiResponseException
    1212{
    1313    /**
    14      * @param string     $message
    15      * @param int        $code
    16      * @param \Exception $previous
     14     * @param string    $message
     15     * @param int       $code
     16     * @param Exception $previous
    1717     */
    18     public function __construct($message = "", $code = 0, \Exception $previous = null)
     18    public function __construct($message = '', $code = 0, Exception $previous = null)
    1919    {
    2020        $message = 'Invalid response' . (empty($message) ? '' : ': ' . $message);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidSelectionException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostInvalidSelectionException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    109 */
    1110class BpostInvalidSelectionException extends BpostApiResponseException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostInvalidXmlResponseException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostApiResponseException;
     6use Exception;
    67
    78/**
    89 * Class BpostInvalidXmlResponseException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    1010 */
    1111class BpostInvalidXmlResponseException extends BpostApiResponseException
    1212{
    1313    /**
    14      * @param string     $message
    15      * @param int        $code
    16      * @param \Exception $previous
     14     * @param string    $message
     15     * @param int       $code
     16     * @param Exception $previous
    1717     */
    18     public function __construct($message = "", $code = 0, \Exception $previous = null)
     18    public function __construct($message = '', $code = 0, Exception $previous = null)
    1919    {
    2020        $message = 'Invalid XML-response' . (empty($message) ? '' : ': ' . $message);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostApiResponseException/BpostTaxipostLocatorException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostTaxipostLocatorException
    9  * @package Bpost\BpostApiClient\Exception\BpostApiResponseException
    109 */
    1110class BpostTaxipostLocatorException extends BpostApiResponseException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostLogicException
    9  * @package Bpost\BpostApiClient\Exception
    109 */
    1110class BpostLogicException extends BpostException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidDayException.php

    r2021946 r3119293  
    33namespace Bpost\BpostApiClient\Exception\BpostLogicException;
    44
     5use Exception;
     6
    57/**
    68 * Class BpostInvalidDayException
    7  * @package Bpost\BpostApiClient\Exception\LogicException
    89 */
    910class BpostInvalidDayException extends BpostInvalidValueException
    1011{
    1112    /**
    12      * @param string     $invalidValue
    13      * @param array      $allowedValues
    14      * @param int        $code
    15      * @param \Exception $previous
     13     * @param string    $invalidValue
     14     * @param array     $allowedValues
     15     * @param int       $code
     16     * @param Exception $previous
    1617     */
    17     public function __construct($invalidValue, array $allowedValues, $code = 0, \Exception $previous = null)
     18    public function __construct($invalidValue, array $allowedValues, $code = 0, Exception $previous = null)
    1819    {
    1920        parent::__construct('day', $invalidValue, $allowedValues, $code, $previous);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidLengthException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostLogicException;
     6use Exception;
    67
    78/**
    89 * Class BpostInvalidLengthException
    9  * @package Bpost\BpostApiClient\Exception\LogicException
    1010 */
    1111class BpostInvalidLengthException extends BpostLogicException
     
    1313    /**
    1414     * 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
    2021     */
    21     public function __construct($nameEntry, $invalidLength, $maximumLength, $code = 0, \Exception $previous = null)
     22    public function __construct($nameEntry, $invalidLength, $maximumLength, $code = 0, Exception $previous = null)
    2223    {
    2324        $message = sprintf(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidPatternException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostLogicException;
     6use Exception;
    67
    78/**
    89 * Class BpostInvalidValueException
    9  * @package Bpost\BpostApiClient\Exception\LogicException
    1010 */
    1111class BpostInvalidPatternException extends BpostLogicException
    1212{
    1313    /**
    14      * @param string     $key
    15      * @param string     $invalidValue
    16      * @param string     $regexPattern
    17      * @param int        $code
    18      * @param \Exception $previous
     14     * @param string    $key
     15     * @param string    $invalidValue
     16     * @param string    $regexPattern
     17     * @param int       $code
     18     * @param Exception $previous
    1919     */
    20     public function __construct($key, $invalidValue, $regexPattern, $code = 0, \Exception $previous = null)
     20    public function __construct($key, $invalidValue, $regexPattern, $code = 0, Exception $previous = null)
    2121    {
    2222        $message = sprintf(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidValueException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostLogicException;
     6use Exception;
    67
    78/**
    89 * Class BpostInvalidValueException
    9  * @package Bpost\BpostApiClient\Exception\LogicException
    1010 */
    1111class BpostInvalidValueException extends BpostLogicException
    1212{
    1313    /**
    14      * @param string     $key
    15      * @param string     $invalidValue
    16      * @param array      $allowedValues
    17      * @param int        $code
    18      * @param \Exception $previous
     14     * @param string    $key
     15     * @param string    $invalidValue
     16     * @param array     $allowedValues
     17     * @param int       $code
     18     * @param Exception $previous
    1919     */
    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)
    2121    {
    2222        $message = sprintf(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostLogicException/BpostInvalidWeightException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostLogicException;
     6use Exception;
    67
    78/**
    89 * Class BpostInvalidWeightException
    9  * @package Bpost\BpostApiClient\Exception\LogicException
    1010 */
    1111class BpostInvalidWeightException extends BpostLogicException
    1212{
    1313    /**
    14      * @param string     $invalidWeight
    15      * @param int        $maximumWeight
    16      * @param int        $code
    17      * @param \Exception $previous
     14     * @param string    $invalidWeight
     15     * @param int       $maximumWeight
     16     * @param int       $code
     17     * @param Exception $previous
    1818     */
    19     public function __construct($invalidWeight, $maximumWeight, $code = 0, \Exception $previous = null)
     19    public function __construct($invalidWeight, $maximumWeight, $code = 0, Exception $previous = null)
    2020    {
    2121        $message = sprintf(
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostNotImplementedException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\BpostException;
     6use Exception;
    67
    78/**
    89 * Class BpostNotImplementedException
    9  * @package Bpost\BpostApiClient\Exception
    1010 */
    1111class BpostNotImplementedException extends BpostException
    1212{
    1313    /**
    14      * @param string     $message
    15      * @param int        $code
    16      * @param \Exception $previous
     14     * @param string    $message
     15     * @param int       $code
     16     * @param Exception $previous
    1717     */
    18     public function __construct($message = "", $code = 0, \Exception $previous = null)
     18    public function __construct($message = '', $code = 0, Exception $previous = null)
    1919    {
    2020        $message = 'Not implemented' . (empty($message) ? '' : ': ' . $message);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/BpostXmlException.php

    r1467688 r3119293  
    77/**
    88 * Class BpostXmlException
    9  * @package Bpost\BpostApiClient\Exception
    109 */
    1110class BpostXmlException extends BpostException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlInvalidItemException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostXmlException;
     6use Exception;
    67
    78/**
    89 * Class BpostXmlInvalidItemException
    9  * @package Bpost\BpostApiClient\Exception\XmlException
    1010 */
    1111class BpostXmlInvalidItemException extends BpostXmlException
    1212{
    1313    /**
    14      * @param string     $message
    15      * @param int        $code
    16      * @param \Exception $previous
     14     * @param string    $message
     15     * @param int       $code
     16     * @param Exception $previous
    1717     */
    18     public function __construct($message = "", $code = 0, \Exception $previous = null)
     18    public function __construct($message = '', $code = 0, Exception $previous = null)
    1919    {
    2020        $message = 'Invalid item' . (empty($message) ? '' : ': ' . $message);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlNoReferenceFoundException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostXmlException;
     6use Exception;
    67
    78/**
    89 * Class BpostXmlNoReferenceFoundException
    9  * @package Bpost\BpostApiClient\Exception\XmlException
    1010 */
    1111class BpostXmlNoReferenceFoundException extends BpostXmlException
    1212{
    1313    /**
    14      * @param string     $message
    15      * @param int        $code
    16      * @param \Exception $previous
     14     * @param string    $message
     15     * @param int       $code
     16     * @param Exception $previous
    1717     */
    18     public function __construct($message = "", $code = 0, \Exception $previous = null)
     18    public function __construct($message = '', $code = 0, Exception $previous = null)
    1919    {
    2020        $message = 'No reference found' . (empty($message) ? '' : ': ' . $message);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Exception/XmlException/BpostXmlNoUserIdFoundException.php

    r1467688 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostXmlException;
     6use Exception;
    67
    78/**
    89 * Class BpostXmlNoUserIdFoundException
    9  * @package Bpost\BpostApiClient\Exception\XmlException
    1010 */
    1111class BpostXmlNoUserIdFoundException extends BpostXmlException
    1212{
    1313    /**
    14      * @param string     $message
    15      * @param int        $code
    16      * @param \Exception $previous
     14     * @param string    $message
     15     * @param int       $code
     16     * @param Exception $previous
    1717     */
    18     public function __construct($message = "", $code = 0, \Exception $previous = null)
     18    public function __construct($message = '', $code = 0, Exception $previous = null)
    1919    {
    2020        $message = 'No UserId found' . (empty($message) ? '' : ': ' . $message);
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/FormHandler.php

    r2890340 r3119293  
    6060        foreach ($keysToHash as $key) {
    6161            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] . '&';
    6464                } else {
    6565                    foreach ($this->parameters[$key] as $entry) {
    66                         $base .= $key.'='.$entry.'&';
     66                        $base .= $key . '=' . $entry . '&';
    6767                    }
    6868                }
     
    8080     * Get the parameters
    8181     *
    82      * @param  bool  $form
    83      * @param  bool  $includeChecksum
     82     * @param bool $form
     83     * @param bool $includeChecksum
     84     *
    8485     * @return array
    8586     */
     
    109110     * @param string $key
    110111     * @param mixed  $value
     112     *
    111113     * @throws BpostInvalidValueException
    112114     * @throws BpostInvalidLengthException
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6.php

    r3068120 r3119293  
    88use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostTaxipostLocatorException;
    99use Bpost\BpostApiClient\Geo6\Poi;
     10use SimpleXMLElement;
    1011
    1112/**
     
    1314 *
    1415 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     16 *
    1517 * @version   3.0.0
     18 *
    1619 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1720 * @license   BSD License
     
    6366    /**
    6467     * Constructor
     68     *
    6569     * @param string $partner Static parameter used for protection/statistics
    6670     * @param string $appId   Static parameter used for protection/statistics
     
    6872    public function __construct($partner, $appId)
    6973    {
    70         $this->setPartner((string)$partner);
    71         $this->setAppId((string)$appId);
     74        $this->setPartner((string) $partner);
     75        $this->setAppId((string) $appId);
    7276    }
    7377
     
    8084            $this->apiCaller = new ApiCaller(new Logger());
    8185        }
     86
    8287        return $this->apiCaller;
    8388    }
     
    96101     * @param string $method
    97102     * @param array  $parameters
     103     *
    98104     * @return string
    99105     */
     
    106112     * Build the parameters to send (URL-encoded string)
    107113     *
    108      * @param  string $method
    109      * @param  array  $parameters
     114     * @param string $method
     115     * @param array  $parameters
     116     *
    110117     * @return string
    111118     */
     
    124131     * Make the real call
    125132     *
    126      * @param  string $method
    127      * @param  array  $parameters
    128      * @return \SimpleXMLElement
     133     * @param string $method
     134     * @param array  $parameters
     135     *
     136     * @return SimpleXMLElement
     137     *
    129138     * @throws BpostCurlException
    130139     * @throws BpostInvalidXmlResponseException
     
    140149            CURLOPT_SSL_VERIFYHOST => false,
    141150            CURLOPT_RETURNTRANSFER => true,
    142             CURLOPT_TIMEOUT => (int)$this->getTimeOut(),
     151            CURLOPT_TIMEOUT => (int) $this->getTimeOut(),
    143152
    144153            CURLOPT_POST => true,
     
    157166
    158167        // 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);
    161170        }
    162171
     
    205214    public function setTimeOut($seconds)
    206215    {
    207         $this->timeOut = (int)$seconds;
     216        $this->timeOut = (int) $seconds;
    208217    }
    209218
     
    215224    public function getTimeOut()
    216225    {
    217         return (int)$this->timeOut;
     226        return (int) $this->timeOut;
    218227    }
    219228
     
    227236    public function getUserAgent()
    228237    {
    229         return (string)'PHP Bpost Geo6/' . self::VERSION . ' ' . $this->userAgent;
     238        return (string) 'PHP Bpost Geo6/' . self::VERSION . ' ' . $this->userAgent;
    230239    }
    231240
     
    238247    public function setUserAgent($userAgent)
    239248    {
    240         $this->userAgent = (string)$userAgent;
     249        $this->userAgent = (string) $userAgent;
    241250    }
    242251
     
    257266     * @param int    $limit
    258267     * @param string $country  Country: "BE", "FR"...
     268     *
    259269     * @return array
     270     *
    260271     * @throws BpostCurlException
    261272     * @throws BpostInvalidXmlResponseException
    262273     * @throws BpostTaxipostLocatorException
    263274     */
    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)
    265276    public function getNearestServicePoint($street, $number, $zone, $language = 'nl', $type = 3, $limit = 10, $country = 'BE')
    266277    {
    267278        $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)$limit
     279            '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,
    275286        );
    276287
     
    285296            $pois[] = array(
    286297                'poi' => Poi::createFromXML($poi),
    287                 'distance' => (float)$poi->Distance,
     298                'distance' => (float) $poi->Distance,
    288299            );
    289300        }
     
    305316     *
    306317     * @return Poi
     318     *
    307319     * @throws BpostCurlException
    308320     * @throws BpostInvalidXmlResponseException
     
    312324    {
    313325        $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,
    318330        );
    319331
     
    332344     * @param int    $type
    333345     * @param string $country
     346     *
    334347     * @return string
    335348     *
     
    339352    {
    340353        $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,
    345358        );
    346359
     
    353366     * @param int    $type
    354367     * @param string $country
     368     *
    355369     * @return string
    356370     *
     
    368382     * @param bool $withBpack247
    369383     * @param bool $withClickAndCollectShop
     384     *
    370385     * @return int
    371386     */
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6/Day.php

    r2890340 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostLogicException\BpostInvalidDayException;
     6use SimpleXMLElement;
    67
    78/**
     
    910 *
    1011 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     12 *
    1113 * @version   3.0.0
     14 *
    1215 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1316 * @license   BSD License
     
    116119    /**
    117120     * Get the index for a day
     121     *
    118122     * @return int
     123     *
    119124     * @throws BpostInvalidDayException
    120125     */
     
    163168
    164169    /**
    165      * @param  \SimpleXMLElement $xml
     170     * @param SimpleXMLElement $xml
     171     *
    166172     * @return Day
    167173     */
    168     public static function createFromXML(\SimpleXMLElement $xml)
     174    public static function createFromXML(SimpleXMLElement $xml)
    169175    {
    170176        $day = new Day();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6/Poi.php

    r2021946 r3119293  
    44
    55use Bpost\BpostApiClient\Exception\BpostApiResponseException\BpostInvalidXmlResponseException;
     6use SimpleXMLElement;
    67
    78/**
     
    910 *
    1011 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     12 *
    1113 * @version   3.0.0
     14 *
    1215 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1316 * @license   BSD License
     
    7174    public function setCity($city)
    7275    {
    73         $this->city = (string)$city;
     76        $this->city = (string) $city;
    7477    }
    7578
     
    120123    public function addHour($index, Day $day)
    121124    {
    122         $this->hours[(int)$index] = $day;
     125        $this->hours[(int) $index] = $day;
    123126    }
    124127
     
    144147    public function setId($id)
    145148    {
    146         $this->id = (string)$id;
     149        $this->id = (string) $id;
    147150    }
    148151
     
    160163    public function setLatitude($latitude)
    161164    {
    162         $this->latitude = (float)$latitude;
     165        $this->latitude = (float) $latitude;
    163166    }
    164167
     
    176179    public function setLongitude($longitude)
    177180    {
    178         $this->longitude = (float)$longitude;
     181        $this->longitude = (float) $longitude;
    179182    }
    180183
     
    192195    public function setNote($note)
    193196    {
    194         $this->note = (string)$note;
     197        $this->note = (string) $note;
    195198    }
    196199
     
    208211    public function setNr($nr)
    209212    {
    210         $this->nr = (string)$nr;
     213        $this->nr = (string) $nr;
    211214    }
    212215
     
    224227    public function setOffice($office)
    225228    {
    226         $this->office = (string)$office;
     229        $this->office = (string) $office;
    227230    }
    228231
     
    264267    public function setStreet($street)
    265268    {
    266         $this->street = (string)$street;
     269        $this->street = (string) $street;
    267270    }
    268271
     
    280283    public function setType($type)
    281284    {
    282         $this->type = (string)$type;
     285        $this->type = (string) $type;
    283286    }
    284287
     
    296299    public function setX($x)
    297300    {
    298         $this->x = (int)$x;
     301        $this->x = (int) $x;
    299302    }
    300303
     
    312315    public function setY($y)
    313316    {
    314         $this->y = (int)$y;
     317        $this->y = (int) $y;
    315318    }
    316319
     
    328331    public function setZip($zip)
    329332    {
    330         $this->zip = (string)$zip;
     333        $this->zip = (string) $zip;
    331334    }
    332335
     
    352355    public function setPage($page)
    353356    {
    354         $this->page = (string)$page;
    355     }
    356 
     357        $this->page = (string) $page;
     358    }
    357359
    358360    /**
    359361     * Create a POI based on an XML-object
    360362     *
    361      * @param  \SimpleXMLElement $xml
     363     * @param SimpleXMLElement $xml
     364     *
    362365     * @return Poi
     366     *
    363367     * @throws BpostInvalidXmlResponseException
    364368     */
    365     public static function createFromXML(\SimpleXMLElement $xml)
     369    public static function createFromXML(SimpleXMLElement $xml)
    366370    {
    367371        if (!isset($xml->Record)) {
     
    374378
    375379        if (isset($recordXml->Id) && $recordXml->Id != '') {
    376             $poi->setId((string)$recordXml->Id);
     380            $poi->setId((string) $recordXml->Id);
    377381        }
    378382        if (isset($recordXml->ID) && $recordXml->ID != '') {
    379             $poi->setId((string)$recordXml->ID);
     383            $poi->setId((string) $recordXml->ID);
    380384        }
    381385        if (isset($recordXml->Type) && $recordXml->Type != '') {
    382             $poi->setType((string)$recordXml->Type);
     386            $poi->setType((string) $recordXml->Type);
    383387        }
    384388        if (isset($recordXml->Name) && $recordXml->Name != '') {
    385             $poi->setOffice((string)$recordXml->Name);
     389            $poi->setOffice((string) $recordXml->Name);
    386390        }
    387391        if (isset($recordXml->OFFICE) && $recordXml->OFFICE != '') {
    388             $poi->setOffice((string)$recordXml->OFFICE);
     392            $poi->setOffice((string) $recordXml->OFFICE);
    389393        }
    390394        if (isset($recordXml->Street) && $recordXml->Street != '') {
    391             $poi->setStreet((string)$recordXml->Street);
     395            $poi->setStreet((string) $recordXml->Street);
    392396        }
    393397        if (isset($recordXml->STREET) && $recordXml->STREET != '') {
    394             $poi->setStreet((string)$recordXml->STREET);
     398            $poi->setStreet((string) $recordXml->STREET);
    395399        }
    396400        if (isset($recordXml->Number) && $recordXml->Number != '') {
    397             $poi->setNr((string)$recordXml->Number);
     401            $poi->setNr((string) $recordXml->Number);
    398402        }
    399403        if (isset($recordXml->NR) && $recordXml->NR != '') {
    400             $poi->setNr((string)$recordXml->NR);
     404            $poi->setNr((string) $recordXml->NR);
    401405        }
    402406        if (isset($recordXml->Zip) && $recordXml->Zip != '') {
    403             $poi->setZip((string)$recordXml->Zip);
     407            $poi->setZip((string) $recordXml->Zip);
    404408        }
    405409        if (isset($recordXml->ZIP) && $recordXml->ZIP != '') {
    406             $poi->setZip((string)$recordXml->ZIP);
     410            $poi->setZip((string) $recordXml->ZIP);
    407411        }
    408412        if (isset($recordXml->City) && $recordXml->City != '') {
    409             $poi->setCity((string)$recordXml->City);
     413            $poi->setCity((string) $recordXml->City);
    410414        }
    411415        if (isset($recordXml->CITY) && $recordXml->CITY != '') {
    412             $poi->setCity((string)$recordXml->CITY);
     416            $poi->setCity((string) $recordXml->CITY);
    413417        }
    414418        if (isset($recordXml->X) && $recordXml->X != '') {
    415             $poi->setX((int)$recordXml->X);
     419            $poi->setX((int) $recordXml->X);
    416420        }
    417421        if (isset($recordXml->Y) && $recordXml->Y != '') {
    418             $poi->setY((int)$recordXml->Y);
     422            $poi->setY((int) $recordXml->Y);
    419423        }
    420424        if (isset($recordXml->Longitude) && $recordXml->Longitude != '') {
    421             $poi->setLongitude((float)$recordXml->Longitude);
     425            $poi->setLongitude((float) $recordXml->Longitude);
    422426        }
    423427        if (isset($recordXml->Latitude) && $recordXml->Latitude != '') {
    424             $poi->setLatitude((float)$recordXml->Latitude);
     428            $poi->setLatitude((float) $recordXml->Latitude);
    425429        }
    426430        if (isset($recordXml->Services) && isset($recordXml->Services->Service)) {
     
    457461
    458462        if (isset($recordXml->ClosedFrom) && $recordXml->ClosedFrom != '') {
    459             $closedFrom = (string)$recordXml->ClosedFrom;
     463            $closedFrom = (string) $recordXml->ClosedFrom;
    460464            $poi->setClosedFrom((array) $closedFrom);
    461465        }
    462466        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);
    465469        }
    466470        if (isset($recordXml->NOTE) && $recordXml->NOTE != '') {
    467             $poi->setNote((string)$recordXml->NOTE);
     471            $poi->setNote((string) $recordXml->NOTE);
    468472        }
    469473
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Geo6/Service.php

    r1467688 r3119293  
    22
    33namespace Bpost\BpostApiClient\Geo6;
     4
     5use SimpleXMLElement;
    46
    57/**
     
    79 *
    810 * @author    Tijs Verkoyen <php-bpost@verkoyen.eu>
     11 *
    912 * @version   3.0.0
     13 *
    1014 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
    1115 * @license   BSD License
     
    7781
    7882    /**
    79      * @param  \SimpleXMLElement $xml
     83     * @param SimpleXMLElement $xml
     84     *
    8085     * @return Service
    8186     */
    82     public static function createFromXML(\SimpleXMLElement $xml)
     87    public static function createFromXML(SimpleXMLElement $xml)
    8388    {
    8489        $service = new Service();
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/Logger.php

    r2890340 r3119293  
    77/**
    88 * Class Logger
    9  * @package Bpost\BpostApiClient
    109 */
    1110class Logger
    1211{
    13     /** @var  LoggerInterface */
     12    /** @var LoggerInterface */
    1413    private $logger;
    1514
  • bpost-shipping/trunk/vendor/antidot-be/bpost-api-library/src/tijsverkoyen_classes.php

    r1529584 r3119293  
    1818namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class AutomaticSecondPresentation extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\AutomaticSecondPresentation {} } // src/Bpost/Order/Box/Option/AutomaticSecondPresentation.php
    1919namespace 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\Insurance {} } // src/Bpost/Order/Box/Option/Insurance.php
     20namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class Insurance extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\Insured {} } // src/Bpost/Order/Box/Option/Insured.php
    2121namespace TijsVerkoyen\Bpost\Bpost\Order\Box\Option { /** @deprecated */ class Messaging extends \Bpost\BpostApiClient\Bpost\Order\Box\Option\Messaging {} } // src/Bpost/Order/Box/Option/Messaging.php
    2222namespace 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  
    77
    88return array(
     9    'Tests\\' => array($vendorDir . '/antidot-be/bpost-api-library/tests'),
    910    'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
    1011    'Bpost\\BpostApiClient\\' => array($vendorDir . '/antidot-be/bpost-api-library/src'),
  • bpost-shipping/trunk/vendor/composer/autoload_static.php

    r3117106 r3119293  
    88{
    99    public static $prefixLengthsPsr4 = array (
     10        'T' =>
     11        array (
     12            'Tests\\' => 6,
     13        ),
    1014        'P' =>
    1115        array (
     
    1923
    2024    public static $prefixDirsPsr4 = array (
     25        'Tests\\' =>
     26        array (
     27            0 => __DIR__ . '/..' . '/antidot-be/bpost-api-library/tests',
     28        ),
    2129        'Psr\\Log\\' =>
    2230        array (
  • bpost-shipping/trunk/vendor/composer/installed.json

    r3079657 r3119293  
    33        {
    44            "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",
    77            "source": {
    88                "type": "git",
    99                "url": "https://github.com/Antidot-be/bpost-api-library.git",
    10                 "reference": "eff1fe611d1b39f56d257515d293a4f61ba0cc2c"
     10                "reference": "f7a3a903e7acb7e7e159016ed37bef05c4aa408d"
    1111            },
    1212            "dist": {
    1313                "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",
    1616                "shasum": ""
    1717            },
     
    2828                "phpunit/phpunit": "^5"
    2929            },
    30             "time": "2022-11-22T14:19:58+00:00",
     30            "time": "2024-07-16T14:04:09+00:00",
     31            "default-branch": true,
    3132            "type": "library",
    3233            "installation-source": "dist",
    3334            "autoload": {
    3435                "psr-4": {
     36                    "Tests\\": "tests/",
    3537                    "Bpost\\BpostApiClient\\": "src/"
    3638                },
     
    6466            "support": {
    6567                "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"
    6769            },
    6870            "install-path": "../antidot-be/bpost-api-library"
  • bpost-shipping/trunk/vendor/composer/installed.php

    r3079657 r3119293  
    1212    'versions' => array(
    1313        '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',
    1616            'type' => 'library',
    1717            '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',
    2022            'dev_requirement' => false,
    2123        ),
Note: See TracChangeset for help on using the changeset viewer.