public static function convertToShippoObject($resp, $apiKey)
    {
        // TODO: Have API Return Object: Type in order to cast properly
        $types = array(
            'QUOTE' => 'Shippo_Address'
        );
        if (self::isList($resp)) {
            $mapped = array();
            foreach ($resp as $i)
                array_push($mapped, self::convertToShippoObject($i, $apiKey));
            return $mapped;
        } else if (is_array($resp)) {
            if (isset($resp['object_purpose']) && is_string($resp['object_purpose']) && isset($types[$resp['object_purpose']])) {
                $class = $types[$resp['object_purpose']];
            } else {
                $class = 'Shippo_Object';
            }
            return Shippo_Object::scopedConstructFrom($class, $resp, $apiKey);
        } else {
            return $resp;
        }
    }
public static function convertToShippoObject($resp, $apiKey)
    {
        // TODO: Have API Return Object: Type in order to cast properly
        $types = array(
            'QUOTE' => 'Shippo_Address'
        );
        if (self::isList($resp)) {
            $mapped = array();
            foreach ($resp as $i)
                array_push($mapped, self::convertToShippoObject($i, $apiKey));
            return $mapped;
        } else if (is_array($resp)) {
            if (isset($resp['object_purpose']) && is_string($resp['object_purpose']) && isset($types[$resp['object_purpose']])) {
                $class = $types[$resp['object_purpose']];
            } else {
                $class = 'Shippo_Object';
            }
            return Shippo_Object::scopedConstructFrom($class, $resp, $apiKey);
        } else {
            return $resp;
        }
    }
public static function convertToShippoObject ( $ resp , $ apiKey ) { // TODO: Have API Return Object: Type in order to cast properly $ types = array ( 'QUOTE' => 'Shippo_Address' ) ; if ( self :: isList ( $ resp ) ) { $ mapped = array ( ) ; foreach ( $ resp as $ i ) array_push ( $ mapped , self :: convertToShippoObject ( $ i , $ apiKey ) ) ; return $ mapped ; } else if ( is_array ( $ resp ) ) { if ( isset ( $ resp [ 'object_purpose' ] ) && is_string ( $ resp [ 'object_purpose' ] ) && isset ( $ types [ $ resp [ 'object_purpose' ] ] ) ) { $ class = $ types [ $ resp [ 'object_purpose' ] ] ; } else { $ class = 'Shippo_Object' ; } return Shippo_Object :: scopedConstructFrom ( $ class , $ resp , $ apiKey ) ; } else { return $ resp ; } }
Converts a response from the Shippo API to the corresponding PHP object.

@param array $resp The response from the Shippo API.
@param string $apiKey
@return Shippo_Object|array
Converts a response from the Shippo API to the corresponding PHP object .