Returns a stdObj representation of the node.

@return \stdClass
171589
public function toStdObject()
    {
        $object = new \stdClass();
        $object->uid = $this->getUid();
        $object->level = $this->getLevel();
        $object->keyword = $this->getKeyword();
        $object->children = array();
        return $object;
    }
875253
public function ToString()
	{
		$sb = array_reduce( $this->ToList(), function( $carry, /** @var XPath2Item $item */ $item )
		{
			$carry[] = $item->ToString();
			return $carry;
		}, array() );
		$s = implode( ", ", $sb );
		return $s;

		$sb = array();
		foreach ( $this->ToList() as $node )
		{
			$sb[] = is_object( $node ) ? $node->ToString() : $node;
		}

		$s = implode( ", ", $sb );

		return empty( $s)
			? "<empty>"
			: $s;
	}
1204121
public function toString() {
        $documentation = preg_replace_callback(
            '@\r?\n@',
            function ($matches) {
                return $matches[0] . '	 * ';
            },
            trim($this->getDescription())
        );
        if($documentation == '') {
            $documentation = $this->getName();
        }
        $buffer = '
	/**
	 * ' . $documentation . '
';
        foreach($this->getParameters() as $parameter) {
            $buffer .= $parameter->toDocTypeString($this);
        }
        if($this->getName() != '__construct') {
            $buffer .= '	 * @return ' . $this->getReturnType() . '
';
        }
        foreach($this->getThrows() as $throw) {
            $buffer .= '	 * @throws ' . $throw . '
';
        }
        $buffer .= '	 */
	' . ($this->isFinal() ? 'final ' : '') . $this->getAccess() . ' ' . ($this->isStatic() ? 'static ' : '') . 'function ' . $this->getName() . '(';
        foreach($this->getParameters() as $key => $parameter) {
            if($key != 0) {
                $buffer .= ', ';
            }
            if($parameter->isStrictType()) {
                if(!is_null($parameter->getStrictClass())) {
                    $buffer .= $parameter->getStrictClass() . ' ';
                } else {
                    $buffer .= $parameter->getType() . ' ';
                }
            }
            $buffer .= '$' . $parameter->getName();
            if(!is_null($parameter->getDefaultValue())) {
                $buffer .= '=' . $parameter->getDefaultValue();
            }
        }
        $buffer .= ') {
		' . trim($this->getContent()) . '
	}
';
        return $buffer;
    }
48285
protected function _declareNode()
    {
        $this->_codeNode();
        $body = $this->_stream->current() . $this->_stream->next([';', '{']);

        if (preg_match('~ticks~i', $body, $matches)) {
            $isBlock = substr($body, -1) === '{';
            if ($isBlock) {
                $body = substr($body, 0, -1);
            }
            $node = new NodeDef($body, 'declare');
            $this->_contextualize($node);

            if ($isBlock) {
                $this->_states['body'] .= '{';
                $this->_states['current'] = $this->_codeNode();
            }
            return $node;
        }
        $this->_states['body'] .= $body;
        $node = new BlockDef($body, 'declare');
        $node->hasMethods = false;
        $this->_states['current'] = $this->_root;
        $this->_contextualize($node);
        return $this->_states['current'] = $node;
    }
734097
protected function _classNode()
    {
        if (substr($this->_states['body'], -2) === '::') { // Bails out on `::class`
            $this->_states['body'] .= 'class';
            return;
        }

        $this->_codeNode();
        $token = $this->_stream->current(true);
        $body = $token[1];
        $body .= $this->_stream->skipWhitespaces();
        $body .= $name = $this->_stream->current();
        if ($name !== '{') {
            $body .= $this->_stream->next(['{', T_EXTENDS, T_IMPLEMENTS]);
        } else {
            $name = '';
        }
        $token = $this->_stream->current(true);
        $extends = '';
        $implements = '';
        if ($token[0] === T_EXTENDS) {
            $body .= $this->_stream->skipWhitespaces();
            $body .= $extends = $this->_stream->skipWhile([T_STRING, T_NS_SEPARATOR]);
            $body .= $this->_stream->current();
            if ($this->_stream->current() !== '{') {
                $body .= $this->_stream->next('{');
            }
        } elseif ($token[0] === T_IMPLEMENTS) {
            $body .= $implements = $this->_stream->next('{');
            $implements = substr($implements, 0, -1);
        }
        $node = new BlockDef($body, 'class');
        $node->name = $name;
        $node->extends = $this->_normalizeClass($extends);
        $node->implements = $this->_normalizeImplements($implements);

        $this->_states['body'] .= $body;
        return $this->_states['current'] = $this->_contextualize($node);
    }
715874
public function getDescription()
    {
        if ($this->description && strpos(strtolower($this->description), '{@inheritdoc}') === false) {
            return $this->description;
        }

        $parentElement = $this->getInheritedElement();
        if ($parentElement instanceof DescriptorAbstract) {
            $parentDescription = $parentElement->getDescription();

            return $this->description
                ? str_ireplace('{@inheritdoc}', $parentDescription, $this->description)
                : $parentDescription;
        }

        return $this->description;
    }
1068546
public function getDocument()
    {
        if (null === $this->document) {
            $parent = $this->parent;
            while (true) {
                if (!$parent) {
                    break;
                }
                if ($parent->parent) {
                    $parent = $parent->parent;
                } else {
                    break;
                }
            }
            $this->document = $parent;
        }

        return $this->document;
    }
168327
public function getInnerHtml()
    {
        $html = '';
        if ($content_node = $this->getFirstElmNode()) {
            $document = $content_node->ownerDocument;

            foreach ($content_node->childNodes as $node) {
                if ($this->xml_mode) {
                    $html .= $document->saveXML($node);
                } else {
                    $html .= $document->saveHTML($node);
                }
            }

            $html = $this->handleHtmlResult($html);
        }

        return $html;
    }
700028
public function toString() {
        $documentation = preg_replace_callback(
            '@\r?\n@',
            function ($matches) {
                return $matches[0] . ' * ';
            },
            trim($this->getDocumentation())
        );
        if($documentation == '') {
            $documentation = $this->getName();
        }
        $buffer = '<?php
namespace ' . $this->getNamespace() . ';
';
        foreach($this->getUses() as $use) {
            $buffer .= 'use ' . $use . ';' . "\n";
        }
        $buffer .= '/**
 * ' . $documentation . '
 */
' . ($this->isAbstract() ? 'abstract ' : '') . 'class ' . $this->getName() . ' extends ' . $this->getExtends() . (sizeOf($this->getImplements()) > 0 ? ' implements ' . implode(', ', $this->getImplements()) : '') . ' {
';
        foreach($this->getTraits() as $trait) {
            $buffer .= '	use ' . $trait . ';
';
        }
        foreach($this->getConstants() as $name => $value) {
            $buffer .= '	const ' . $name . ' = \'' . str_replace("'", "\\'", $value) . '\';
';
        }
        foreach($this->getVariables() as $variable) {
            $buffer .= $variable->toString();
        }
        foreach($this->getMethods() as $method) {
            $buffer .= $method->toString();
        }
        $buffer .= '}';
        return str_replace("\r\n", "\n", $buffer);
    }
265577
public function getDomDocument()
    {
        if (null === $this->_domdocument) {
            if (true === $this->isValid()) {
                $mainLayoutRow = new \DOMDocument('1.0', 'UTF-8');
                $mainNode = $mainLayoutRow->createElement('div');
                $mainNode->setAttribute('class', 'row');

                $clearNode = $mainLayoutRow->createElement('div');
                $clearNode->setAttribute('class', 'clear');

                $mainId = '';
                $zones = array();
                foreach ($this->getDataObject()->templateLayouts as $zone) {
                    $mainId = $zone->defaultContainer;
                    $class = $zone->gridClassPrefix.$zone->gridSize;

                    if (true === property_exists($zone, 'alphaClass')) {
                        $class .= ' '.$zone->alphaClass;
                    }

                    if (true === property_exists($zone, 'omegaClass')) {
                        $class .= ' '.$zone->omegaClass;
                    }

                    if (true === property_exists($zone, 'typeClass')) {
                        $class .= ' '.$zone->typeClass;
                    }

                    $zoneNode = $mainLayoutRow->createElement('div');
                    $zoneNode->setAttribute('class', trim($class));
                    $zones['#'.$zone->id] = $zoneNode;

                    $parentNode = isset($zones[$zone->target]) ? $zones[$zone->target] : $mainNode;
                    $parentNode->appendChild($zoneNode);
                    if (true === property_exists($zone, 'clearAfter')
                            && 1 == $zone->clearAfter) {
                        $parentNode->appendChild(clone $clearNode);
                    }
                }

                $mainNode->setAttribute('id', substr($mainId, 1));
                $mainLayoutRow->appendChild($mainNode);

                $this->_domdocument = $mainLayoutRow;
            }
        }

        return $this->_domdocument;
    }
1058797
public function getNode()
    {
        if(null === $this->node)
        {
            $request = $this->requestStack->getCurrentRequest();
            $this->node = $this->readNode(RequestFilter::getFinder($request, $this->contentPath));
        }

        return $this->node;
    }
911672
public function getHtmlBody()
    {
        $xpath = new DOMXPath($this->_doc);
        $bodyNodes = $xpath->query('/html/body')->item(0)->childNodes;

        $outputFragments = array();
        for ($count = 0; $count < $bodyNodes->length; $count++) {
            $outputFragments[] = $this->_doc->saveXML($bodyNodes->item($count));
        }

        return implode($outputFragments);
    }
1123887
public function getDocComment()
    {
        $docComment = false;
        $comments   = $this->namespaceNode->getAttribute('comments');

        if ($comments) {
            $docComment = (string)$comments[0];
        }

        return $docComment;
    }
1270056
public function getTree() {
    $children = array();
    $properties = $this->getChildProperties();
    $child = $this->head;
    $i = 0;
    while ($child) {
      $key = array_search($child, $properties, TRUE);
      if (!$key) {
        $key = $i;
      }
      if ($child instanceof ParentNode) {
        $children[$key] = $child->getTree();
      }
      else {
        /** @var TokenNode $child */
        $children[$key] = array($child->getTypeName() => $child->getText());
      }
      $child = $child->next;
      $i++;
    }
    $class_name = get_class($this);
    return array($class_name => $children);
  }
847434
private function get_attrs()
    {
        $this->attrs = new \stdClass;

        foreach($this->dom_element->attributes as $name => $node)
        {
            $this->attrs->{strtolower($name)} = $node->nodeValue;
        }
        return $this;
    }
1297751
public function toJson()
    {
        $packageDetails = new \stdClass;
        $packageDetails->name = $this->getName();
        $packageDetails->description = $this->getDescription();
        $packageDetails->license = $this->getLicense();
        $packageDetails->authors = $this->getAuthors();

        return json_encode($packageDetails, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    }
895052
private function getDocblock()
    {
        $docblock = $this->stmt->getDocComment();

        if ($docblock) {
            $parsed_docblock = DocComment::parse((string)$docblock, null, true);
        } else {
            $parsed_docblock = ['description' => '', 'specials' => []];
        }

        foreach ($this->new_phpdoc_param_types as $param_name => $phpdoc_type) {
            $found_in_params = false;
            $new_param_block = $phpdoc_type . ' ' . '$' . $param_name;

            if (isset($parsed_docblock['specials']['param'])) {
                foreach ($parsed_docblock['specials']['param'] as &$param_block) {
                    $doc_parts = CommentAnalyzer::splitDocLine($param_block);

                    if (($doc_parts[1] ?? null) === '$' . $param_name) {
                        $param_block = $new_param_block;
                        $found_in_params = true;
                        break;
                    }
                }
            }

            if (!$found_in_params) {
                $parsed_docblock['specials']['param'][] = $new_param_block;
            }
        }

        if ($this->new_phpdoc_return_type) {
            $parsed_docblock['specials']['return'] = [
                $this->new_phpdoc_return_type
                    . ($this->return_type_description ? (' ' . $this->return_type_description) : '')
            ];
        }

        if ($this->new_phpdoc_return_type !== $this->new_psalm_return_type && $this->new_psalm_return_type) {
            $parsed_docblock['specials']['psalm-return'] = [$this->new_psalm_return_type];
        }

        return DocComment::render($parsed_docblock, $this->indentation);
    }