protected function parseRecommendation($xml) {
        $r = array();
        foreach ($xml->children() as $x) {
            if (isset($x->Asin)) {
                $r[$x->getName()]['ASIN'] = (string)$x->Asin;
                $r[$x->getName()]['SKU'] = (string)$x->Sku;
                $r[$x->getName()]['UPC'] = (string)$x->Upc;
            } else if (isset($x->CurrencyCode)) {
                $r[$x->getName()]['Amount'] = (string)$x->Amount;
                $r[$x->getName()]['CurrencyCode'] = (string)$x->CurrencyCode;
            } else if (isset($x->Height)) {
                $r[$x->getName()]['Height']['Value'] = (string)$x->Height->Value;
                $r[$x->getName()]['Height']['Unit'] = (string)$x->Height->Unit;
                $r[$x->getName()]['Width']['Value'] = (string)$x->Width->Value;
                $r[$x->getName()]['Width']['Unit'] = (string)$x->Width->Unit;
                $r[$x->getName()]['Length']['Value'] = (string)$x->Length->Value;
                $r[$x->getName()]['Length']['Unit'] = (string)$x->Length->Unit;
                $r[$x->getName()]['Weight']['Value'] = (string)$x->Weight->Value;
                $r[$x->getName()]['Weight']['Unit'] = (string)$x->Weight->Unit;
            } else {
                $r[$x->getName()] = (string)$x;
            }
        }
        return $r;
    }
protected function parseRecommendation($xml) {
        $r = array();
        foreach ($xml->children() as $x) {
            if (isset($x->Asin)) {
                $r[$x->getName()]['ASIN'] = (string)$x->Asin;
                $r[$x->getName()]['SKU'] = (string)$x->Sku;
                $r[$x->getName()]['UPC'] = (string)$x->Upc;
            } else if (isset($x->CurrencyCode)) {
                $r[$x->getName()]['Amount'] = (string)$x->Amount;
                $r[$x->getName()]['CurrencyCode'] = (string)$x->CurrencyCode;
            } else if (isset($x->Height)) {
                $r[$x->getName()]['Height']['Value'] = (string)$x->Height->Value;
                $r[$x->getName()]['Height']['Unit'] = (string)$x->Height->Unit;
                $r[$x->getName()]['Width']['Value'] = (string)$x->Width->Value;
                $r[$x->getName()]['Width']['Unit'] = (string)$x->Width->Unit;
                $r[$x->getName()]['Length']['Value'] = (string)$x->Length->Value;
                $r[$x->getName()]['Length']['Unit'] = (string)$x->Length->Unit;
                $r[$x->getName()]['Weight']['Value'] = (string)$x->Weight->Value;
                $r[$x->getName()]['Weight']['Unit'] = (string)$x->Weight->Unit;
            } else {
                $r[$x->getName()] = (string)$x;
            }
        }
        return $r;
    }
protected function parseRecommendation ( $ xml ) { $ r = array ( ) ; foreach ( $ xml -> children ( ) as $ x ) { if ( isset ( $ x -> Asin ) ) { $ r [ $ x -> getName ( ) ] [ 'ASIN' ] = ( string ) $ x -> Asin ; $ r [ $ x -> getName ( ) ] [ 'SKU' ] = ( string ) $ x -> Sku ; $ r [ $ x -> getName ( ) ] [ 'UPC' ] = ( string ) $ x -> Upc ; } else if ( isset ( $ x -> CurrencyCode ) ) { $ r [ $ x -> getName ( ) ] [ 'Amount' ] = ( string ) $ x -> Amount ; $ r [ $ x -> getName ( ) ] [ 'CurrencyCode' ] = ( string ) $ x -> CurrencyCode ; } else if ( isset ( $ x -> Height ) ) { $ r [ $ x -> getName ( ) ] [ 'Height' ] [ 'Value' ] = ( string ) $ x -> Height -> Value ; $ r [ $ x -> getName ( ) ] [ 'Height' ] [ 'Unit' ] = ( string ) $ x -> Height -> Unit ; $ r [ $ x -> getName ( ) ] [ 'Width' ] [ 'Value' ] = ( string ) $ x -> Width -> Value ; $ r [ $ x -> getName ( ) ] [ 'Width' ] [ 'Unit' ] = ( string ) $ x -> Width -> Unit ; $ r [ $ x -> getName ( ) ] [ 'Length' ] [ 'Value' ] = ( string ) $ x -> Length -> Value ; $ r [ $ x -> getName ( ) ] [ 'Length' ] [ 'Unit' ] = ( string ) $ x -> Length -> Unit ; $ r [ $ x -> getName ( ) ] [ 'Weight' ] [ 'Value' ] = ( string ) $ x -> Weight -> Value ; $ r [ $ x -> getName ( ) ] [ 'Weight' ] [ 'Unit' ] = ( string ) $ x -> Weight -> Unit ; } else { $ r [ $ x -> getName ( ) ] = ( string ) $ x ; } } return $ r ; }
Parses XML response for a single recommendation into an array.
@param SimpleXMLElement $xml
@return array parsed structure from XML
Parses XML response for a single recommendation into an array .