application/models/bestitamazonpay4oxidaddressutil.php
protected function _parseAddressFields($oAmazonData, array &$aResult)
    {
        // Cleanup address fields and store them to an array
        $aAmazonAddresses = array(
            1 => is_string($oAmazonData->AddressLine1) ? trim($oAmazonData->AddressLine1) : '',
            2 => is_string($oAmazonData->AddressLine2) ? trim($oAmazonData->AddressLine2) : '',
            3 => is_string($oAmazonData->AddressLine3) ? trim($oAmazonData->AddressLine3) : ''
        );

        // Array of iso2 codes of countries that have another addressline order
        $aReverseOrderCountries = $this->getConfig()->getConfigParam('aAmazonReverseOrderCountries');

        $aMap = array_flip($aReverseOrderCountries);
        $aCheckOrder = isset($aMap[$oAmazonData->CountryCode]) === true ? array (2, 1) : array(1, 2);
        $sStreet = '';
        $sCompany = '';

        foreach ($aCheckOrder as $iCheck) {
            if ($aAmazonAddresses[$iCheck] !== '') {
                if ($sStreet !== '') {
                    $sCompany = $aAmazonAddresses[$iCheck];
                    break;
                }

                $sStreet = $aAmazonAddresses[$iCheck];
            }
        }

        if ($aAmazonAddresses[3] !== '') {
            $sCompany = ($sCompany === '') ? $aAmazonAddresses[3] : "{$sCompany}, {$aAmazonAddresses[3]}";
        }

        $aResult['CompanyName'] = $sCompany;

        $aAddress = $this->_parseSingleAddress($sStreet, $oAmazonData->CountryCode);
        $aResult['Street'] = isset($aAddress['Name']) === true ? $aAddress['Name'] : '';
        $aResult['StreetNr'] = isset($aAddress['Number']) === true ? $aAddress['Number'] : '';
        $aResult['AddInfo'] = isset($aAddress['AddInfo']) === true ? $aAddress['AddInfo'] : '';
    }
protected function _parseAddressFields($oAmazonData, array &$aResult)
    {
        // Cleanup address fields and store them to an array
        $aAmazonAddresses = array(
            1 => is_string($oAmazonData->AddressLine1) ? trim($oAmazonData->AddressLine1) : '',
            2 => is_string($oAmazonData->AddressLine2) ? trim($oAmazonData->AddressLine2) : '',
            3 => is_string($oAmazonData->AddressLine3) ? trim($oAmazonData->AddressLine3) : ''
        );

        // Array of iso2 codes of countries that have another addressline order
        $aReverseOrderCountries = $this->getConfig()->getConfigParam('aAmazonReverseOrderCountries');

        $aMap = array_flip($aReverseOrderCountries);
        $aCheckOrder = isset($aMap[$oAmazonData->CountryCode]) === true ? array (2, 1) : array(1, 2);
        $sStreet = '';
        $sCompany = '';

        foreach ($aCheckOrder as $iCheck) {
            if ($aAmazonAddresses[$iCheck] !== '') {
                if ($sStreet !== '') {
                    $sCompany = $aAmazonAddresses[$iCheck];
                    break;
                }

                $sStreet = $aAmazonAddresses[$iCheck];
            }
        }

        if ($aAmazonAddresses[3] !== '') {
            $sCompany = ($sCompany === '') ? $aAmazonAddresses[3] : "{$sCompany}, {$aAmazonAddresses[3]}";
        }

        $aResult['CompanyName'] = $sCompany;

        $aAddress = $this->_parseSingleAddress($sStreet, $oAmazonData->CountryCode);
        $aResult['Street'] = isset($aAddress['Name']) === true ? $aAddress['Name'] : '';
        $aResult['StreetNr'] = isset($aAddress['Number']) === true ? $aAddress['Number'] : '';
        $aResult['AddInfo'] = isset($aAddress['AddInfo']) === true ? $aAddress['AddInfo'] : '';
    }
protected function _parseAddressFields ( $ oAmazonData , array & $ aResult ) { // Cleanup address fields and store them to an array $ aAmazonAddresses = array ( 1 => is_string ( $ oAmazonData -> AddressLine1 ) ? trim ( $ oAmazonData -> AddressLine1 ) : '' , 2 => is_string ( $ oAmazonData -> AddressLine2 ) ? trim ( $ oAmazonData -> AddressLine2 ) : '' , 3 => is_string ( $ oAmazonData -> AddressLine3 ) ? trim ( $ oAmazonData -> AddressLine3 ) : '' ) ; // Array of iso2 codes of countries that have another addressline order $ aReverseOrderCountries = $ this -> getConfig ( ) -> getConfigParam ( 'aAmazonReverseOrderCountries' ) ; $ aMap = array_flip ( $ aReverseOrderCountries ) ; $ aCheckOrder = isset ( $ aMap [ $ oAmazonData -> CountryCode ] ) === true ? array ( 2 , 1 ) : array ( 1 , 2 ) ; $ sStreet = '' ; $ sCompany = '' ; foreach ( $ aCheckOrder as $ iCheck ) { if ( $ aAmazonAddresses [ $ iCheck ] !== '' ) { if ( $ sStreet !== '' ) { $ sCompany = $ aAmazonAddresses [ $ iCheck ] ; break ; } $ sStreet = $ aAmazonAddresses [ $ iCheck ] ; } } if ( $ aAmazonAddresses [ 3 ] !== '' ) { $ sCompany = ( $ sCompany === '' ) ? $ aAmazonAddresses [ 3 ] : "{$sCompany}, {$aAmazonAddresses[3]}" ; } $ aResult [ 'CompanyName' ] = $ sCompany ; $ aAddress = $ this -> _parseSingleAddress ( $ sStreet , $ oAmazonData -> CountryCode ) ; $ aResult [ 'Street' ] = isset ( $ aAddress [ 'Name' ] ) === true ? $ aAddress [ 'Name' ] : '' ; $ aResult [ 'StreetNr' ] = isset ( $ aAddress [ 'Number' ] ) === true ? $ aAddress [ 'Number' ] : '' ; $ aResult [ 'AddInfo' ] = isset ( $ aAddress [ 'AddInfo' ] ) === true ? $ aAddress [ 'AddInfo' ] : '' ; }
Parses the amazon address fields.

@param \stdClass $oAmazonData
@param array     $aResult
Parses the amazon address fields .