Method to get a PHP native value for a SimpleXMLElement object

@param   object  $node  SimpleXMLElement object for which to get the native value.
@return  mixed  Native value of the SimpleXMLElement object.
974299
protected static function _decodeValue($node)
    {
        switch ($node['type'])
        {
            case 'integer':
                $value = (string) $node;
                return (int) $value;
                break;

            case 'string':
                return (string) $node;
                break;

            case 'boolean':
                $value = (string) $node;
                return (bool) $value;
                break;

            case 'double':
                $value = (string) $node;
                return (float) $value;
                break;

            case 'array':
            default     :

                $value = array();
                foreach ($node->children() as $child) {
                    $value[(string) $child['name']] = self::_decodeValue($child);
                }

                break;
        }

        return $value;
    }
1173404
protected function build($node) {
		return preg_replace_callback(
			'/\{~(.+?)~\}|\{\*(.+?)\*\}|\{\-(.+?)\-\}|'.
			'\{\{(.+?)\}\}((\r?\n)*)/s',
			function($expr) {
				if ($expr[1])
					$str='<?php '.$this->token($expr[1]).' ?>';
				elseif ($expr[2])
					return '';
				elseif ($expr[3])
					$str=$expr[3];
				else {
					$str='<?= ('.trim($this->token($expr[4])).')'.
						($this->interpolation?
							(!empty($expr[6])?'."'.$expr[6].'"':''):'').' ?>';
					if (isset($expr[5]))
						$str.=$expr[5];
				}
				return $str;
			},
			$node
		);
	}
555773
protected function formatStringCellValue($node)
    {
        $pNodeValues = [];
        $pNodes = $node->getElementsByTagName(self::XML_NODE_P);

        foreach ($pNodes as $pNode) {
            $currentPValue = '';

            foreach ($pNode->childNodes as $childNode) {
                if ($childNode instanceof \DOMText) {
                    $currentPValue .= $childNode->nodeValue;
                } else if ($childNode->nodeName === self::XML_NODE_S) {
                    $spaceAttribute = $childNode->getAttribute(self::XML_ATTRIBUTE_C);
                    $numSpaces = (!empty($spaceAttribute)) ? intval($spaceAttribute) : 1;
                    $currentPValue .= str_repeat(' ', $numSpaces);
                } else if ($childNode->nodeName === self::XML_NODE_A || $childNode->nodeName === self::XML_NODE_SPAN) {
                    $currentPValue .= $childNode->nodeValue;
                }
            }

            $pNodeValues[] = $currentPValue;
        }

        $escapedCellValue = implode("\n", $pNodeValues);
        $cellValue = $this->escaper->unescape($escapedCellValue);
        return $cellValue;
    }
294086
public function getValueForNode(Node $node)
    {
        if ($node->isNamed()) {
            return $node->getUri();
        } elseif ($node->isLiteral()) {
            return $node->getValue();
        } elseif ($node->isBlank()) {
            return $node->getBlankId();
        } else {
            return null;
        }
    }
1367902
public static function dom2str($node)
    {
        $doc = $node instanceof DOMDocument? $node : $node->ownerDocument;
        return $doc->saveXML($node);
    }
498841
public function enterNode(Node $node): Node
    {
        if (false === ($node instanceof Const_)) {
            return $node;
        }

        foreach ($node->consts as $constant) {
            /** @var Node\Const_ $constant */
            $resolvedConstantName = $this->nameResolver->resolveName(
                new Name(
                    (string) $constant->name,
                    $node->getAttributes()
                )
            )->getName();

            if (false === $this->whitelist->isSymbolWhitelisted((string) $resolvedConstantName, true)) {
                continue;
            }

            if (count($node->consts) > 1) {
                throw new UnexpectedValueException(
                    'Whitelisting a constant declared in a grouped constant statement (e.g. `const FOO = '
                    .'\'foo\', BAR = \'bar\'; is not supported. Consider breaking it down in multiple constant '
                    .'declaration statements'
                );
            }

            return new Expression(
                new FuncCall(
                    new FullyQualified('define'),
                    [
                        new Arg(
                            new String_((string) $resolvedConstantName)
                        ),
                        new Arg($constant->value),
                    ]
                )
            );
        }

        return $node;
    }
538996
public function enterNode(Node $node)
    {
        if ($node instanceof ConstFetch || $node instanceof FuncCall) {
            $node->name = null;
        }

        if ($node instanceof FullyQualified) {
            $this->names[] = $node->toString();
        }

        return $node;
    }
1320341
function getEnumeration( $node )
	{
		if ( ! count( $node->children( SCHEMA_NAMESPACE )->enumeration ) ) return false;

		$result = array();
		foreach ( $node->children( SCHEMA_NAMESPACE )->enumeration as $enumeration )
		{
			if ( empty( $enumeration->attributes()->value ) ) continue;
			$result[] = (string) $enumeration->attributes()->value;
		}

		return $result;
	}
581807
public static function getDOIValue($xml)
    {
        $doiXML = new \DOMDocument();
        $doiXML->loadXML($xml);

        // get the current identifier
        $currentIdentifier = $doiXML->getElementsByTagName('identifier');

        return $currentIdentifier->item(0)->nodeValue;
    }
902015
public function getValue($node, $name)
    {
        if (empty($node)) {
            return '';
        }
        $texto = ! empty($node->getElementsByTagName($name)->item(0)->nodeValue) ?
            $node->getElementsByTagName($name)->item(0)->nodeValue : '';

        return html_entity_decode($texto, ENT_QUOTES, 'UTF-8');
    }
682205
protected function parseValues(\SimpleXMLElement $node)
    {
        $values = [];

        foreach ($node->value as $item) {
            if ($item->count() > 0) {
                $value = $this->parseValues($item);
            } else {
                $value = trim($item);
            }

            if (isset($item['key'])) {
                $values[(string) $item['key']] = $value;
            } else {
                $values[] = $value;
            }
        }

        return $values;
    }
322388
private function decodeNode(\DOMNode $node)
    {
        $nodeName = $node->nodeName;

        $nodeType = substr($nodeName, 5);

        if (self::DATATYPE_OBJECT === $nodeType) {
            return $this->decodeObjectNode($node);
        }

        if (self::DATATYPE_ARRAY === $nodeType) {
            return $this->decodeArrayNode($node);
        }

        if (self::DATATYPE_BOOLEAN === $nodeType) {
            return $this->decodeBooleanNode($node);
        }

        if (self::DATATYPE_STRING === $nodeType) {
            return $this->decodeStringNode($node);
        }

        if (self::DATATYPE_NUMBER === $nodeType) {
            return $this->decodeNumberNode($node);
        }

        if (self::DATATYPE_NULL === $nodeType) {
            return null;
        }

        throw DeserializerRuntimeException::createNotParsable($this->getContentType());
    }
295391
public function parseXml($node)
    {
        foreach ($node->childNodes as $item) {
            if ($item->nodeName != "#text") {
                $this->set( $item->nodeName, $item->nodeValue);
            }
        }

    }
92108
public static String getValue( Element node )
    {
        if( null == node )
        {
            return null;
        }
        String value;
        if( node.getChildNodes().getLength() > 0 )
        {
            value = node.getFirstChild().getNodeValue();
        }
        else
        {
            value = node.getNodeValue();
        }
        return normalize( value );
    }
1336891
public function from($node = null)
    {
        $this->_isProcessed = false;

        if (is_null($node) || $node == '') {
            throw new NullValueException("Null node exception");
        }

        $this->_node = $node;

        return $this;
    }
72602
protected function &getNode(&$node, $key)
    {
        if (is_array($node) && isset($node[$key])) {
            return $node[$key];
        }

        if (!is_object($node) || !isset($node->$key)) {
            $result = null;
            return $result;
        }

        // Special check for __isset and __get
        if (property_exists($node, $key)) {
            return $node->$key;
        }

        if (method_exists($node, '__get')) {
            $value = $node->__get($key);
            return $value;
        }

        $result = null;
        return $result;
    }
1074890
public function getNode( $node )
	{
		for( $i=0; $i<$this->count(); $i++ )
			if( $this->nodes[$i]->getNodeName() == $node )
				return $this->nodes[$i];
		return NULL;
	}