lib/Braintree/Xml/Parser.php
private static function _nodeToValue($node)
    {
        $type = null;
        if ($node instanceof DOMElement) {
            $type = $node->getAttribute('type');
        }

        switch($type) {
        case 'datetime':
            return self::_timestampToUTC((string) $node->nodeValue);
        case 'date':
            return new DateTime((string) $node->nodeValue);
        case 'integer':
            return (int) $node->nodeValue;
        case 'boolean':
            $value =  (string) $node->nodeValue;
            if(is_numeric($value)) {
                return (bool) $value;
            } else {
                return ($value !== "true") ? false : true;
            }
        case 'array':
        case 'collection':
            return self::_nodeToArray($node);
        default:
            if ($node->hasChildNodes()) {
                return self::_nodeToArray($node);
            } elseif (trim($node->nodeValue) === '') {
                return null;
            } else {
                return $node->nodeValue;
            }
        }
    }
private static function _nodeToValue($node)
    {
        $type = null;
        if ($node instanceof DOMElement) {
            $type = $node->getAttribute('type');
        }

        switch($type) {
        case 'datetime':
            return self::_timestampToUTC((string) $node->nodeValue);
        case 'date':
            return new DateTime((string) $node->nodeValue);
        case 'integer':
            return (int) $node->nodeValue;
        case 'boolean':
            $value =  (string) $node->nodeValue;
            if(is_numeric($value)) {
                return (bool) $value;
            } else {
                return ($value !== "true") ? false : true;
            }
        case 'array':
        case 'collection':
            return self::_nodeToArray($node);
        default:
            if ($node->hasChildNodes()) {
                return self::_nodeToArray($node);
            } elseif (trim($node->nodeValue) === '') {
                return null;
            } else {
                return $node->nodeValue;
            }
        }
    }
private static function _nodeToValue ( $ node ) { $ type = null ; if ( $ node instanceof DOMElement ) { $ type = $ node -> getAttribute ( 'type' ) ; } switch ( $ type ) { case 'datetime' : return self :: _timestampToUTC ( ( string ) $ node -> nodeValue ) ; case 'date' : return new DateTime ( ( string ) $ node -> nodeValue ) ; case 'integer' : return ( int ) $ node -> nodeValue ; case 'boolean' : $ value = ( string ) $ node -> nodeValue ; if ( is_numeric ( $ value ) ) { return ( bool ) $ value ; } else { return ( $ value !== "true" ) ? false : true ; } case 'array' : case 'collection' : return self :: _nodeToArray ( $ node ) ; default : if ( $ node -> hasChildNodes ( ) ) { return self :: _nodeToArray ( $ node ) ; } elseif ( trim ( $ node -> nodeValue ) === '' ) { return null ; } else { return $ node -> nodeValue ; } } }
Converts a node to a PHP value

@param DOMNode $node
@return mixed
Converts a node to a PHP value