Skip to content

Latest commit

 

History

History
217 lines (213 loc) · 4.83 KB

ApiDocumentation.md

File metadata and controls

217 lines (213 loc) · 4.83 KB

API Documentation

Node

Node::addChild

Adds a child node

public function addChild ( ?NodeInterface $child )

Node::addChildren

Adds multiple child nodes

public function addChildren ( ...$children )

Node::getParent

Returns the parent node

public function getParent ( ) : ? Node

Node::getFirstChildNode

Returns the first child node of a given type

public function getFirstChildNode ( ...$types )

Node::getFirstToken

Returns the first token of a given kind See: TokenKind class

public function getFirstToken ( ...$kinds )

Node::getChildNodesOfType

Returns all child nodes of a given type

public function getChildNodesOfType ( ...$types )

Node::getChildTokensOfType

Returns all child tokens of a given kind See: TokenKind class

public function getChildTokensOfType ( ...$kinds )

Node::walkDescendantNodesAndTokens

Walks through all descendant nodes and tokens

public function walkDescendantNodesAndTokens ( callable $callback )

Node::walkDescendantNodes

Walks through all descendant nodes

public function walkDescendantNodes ( callable $callback )

Node::walkDescendantTokens

Walks through all descendant tokens

public function walkDescendantTokens ( callable $callback )

Node::getRoot

Returns the root node. Will return self if node has no parent

public function getRoot ( ) : Node

Node::getChildNodesAndTokens

Returns all child nodes and tokens

public function getChildNodesAndTokens ( )

Node::getChildNodes

Returns all child nodes

public function getChildNodes ( )

Node::getChildTokens

Returns all child tokens

public function getChildTokens ( )

Node::getTokenAtOffset

public function getTokenAtOffset ( int $offset )

Node::jsonSerialize

JSON serialize node for debugging purposes

public function jsonSerialize ( ) : mixed

Document

Document::getProlog

Returns the prolog node

public function getProlog ( ) : ? Prolog

Document::getRootElement

Returns the root element node

public function getRootElement ( ) : ? Element

Document::getMisc

Returns the misc node

public function getMisc ( ) : array

Element

Element::getName

Returns the element name as string. Returns null if NAME token is not found

public function getName ( ) : ? string

Element::getAttributes

Returns all element attribute nodes

public function getAttributes ( ) : array

Element::getContent

Returns the content node

public function getContent ( ) : ? Content

Content

Content::getElements

Returns all child element nodes

public function getElements ( ) : array

Content::getReferences

Returns all child reference nodes

public function getReferences ( ) : array

Content::getCharData

Returns all child charData nodes

public function getCharData ( ) : array

Content::getCData

Returns all CData strings

public function getCData ( ) : array

Content::getComments

Returns all comment strings

public function getComments ( ) : array

Attribute

Attribute::getName

Returns the attribute name as string. Returns null if NAME token is not found

public function getName ( ) : ? string

Attribute::getValue

Returns the attribute value as string (without quotes) Returns null if STRING token is not found

public function getValue ( ) : ? string

Attribute::getFullValue

Returns the attribute value as string (with quotes) Returns null if STRING token is not found

public function getFullValue ( ) : ? string

CharData

CharData::getText

Returns the text content of the node. Does not include whitesspace

public function getText ( ) : ? string

Misc

Prolog

Prolog::getAttributes

Returns all child attribute nodes

public function getAttributes ( ) : array

Reference

Reference::getEntityRef

Returns the entity reference as string.

public function getEntityRef ( ) : ? string

Reference::getCharRef

Returns the character reference as string.

public function getCharRef ( ) : ? string

Parser

Parser::__construct

public function __construct ( )

Parser::parse

Parses an XML string into a Document node

public function parse ( string $xml ) : Node\Document

Lexer

Lexer::__construct

public function __construct ( )

Lexer::tokenize

Splits raw XML string into tokens

public function tokenize ( string $input )

Token

Token::__construct

public function __construct ( int $kind,
        string $fullValue,
        string $value,
        int $offset,
        int $fullOffset, )

Token::jsonSerialize

JSON serialize token for debugging purposes

public function jsonSerialize ( ) : mixed