$replaceFunction
$replaceFunction : callable
$eventListeners : array<mixed,\Phug\Event\ListenerQueue>
$parser : \Phug\Parser
$documentNode : \Phug\Parser\Node\DocumentNode
The root node of the currently parsed document.
$parentNode : \Phug\Parser\Node
The parent that currently found childs are appended to.
When an
$currentNode : \Phug\Parser\Node
The current element in the queue.
Will be appended to $_currentParent when a
$lastNode : \Phug\Parser\Node
The last element that was completely put together.
Will be set on a
$outerNode : \Phug\Parser\Node
Stores an expanded node to attach it to the expanding node later.
getEventListeners() : array<mixed,\Phug\Event\ListenerQueue>
Returns current event listeners by event name.
mergeEventListeners(array<mixed,\Phug\Event\ListenerQueue>|\Phug\EventManagerInterface $eventListeners) : boolean
Merge current events listeners with a given list.
array<mixed,\Phug\Event\ListenerQueue>|\Phug\EventManagerInterface | $eventListeners | event listeners by event name |
true on success false on failure
attach(string $event, callable $callback, integer $priority) : boolean
Attaches a listener to an event.
string | $event | the event to attach too |
callable | $callback | a callable function |
integer | $priority | the priority at which the $callback executed |
true on success false on failure
trigger(string|\Phug\EventInterface $event, object|string $target = null, array|object $argv = array()) : mixed
Trigger an event.
Can accept an EventInterface or will create one if not passed
string|\Phug\EventInterface | $event | |
object|string | $target | |
array|object | $argv |
__construct(\Phug\Parser $parser, \Iterator $tokens, array $options = null)
\Phug\Parser | $parser | |
\Iterator | $tokens | |
array | $options |
getInterpolationNode() : \Phug\Parser\NodeInterface|null
popInterpolationNode() : \Phug\Parser\NodeInterface
pushInterpolationNode(\Phug\Parser\NodeInterface $node) : integer
\Phug\Parser\NodeInterface | $node |
getParser() : \Phug\Parser
getDocumentNode() : \Phug\Parser\Node\DocumentNode
getParentNode() : \Phug\Parser\Node
setParentNode(\Phug\Parser\Node $currentParent) : $this
\Phug\Parser\Node | $currentParent |
getCurrentNode() : \Phug\Parser\Node
setCurrentNode(\Phug\Parser\Node $current) : $this
\Phug\Parser\Node | $current |
append(\Phug\Parser\Node $node) : $this
Append to current node, or set as current if node selected.
\Phug\Parser\Node | $node |
getLastNode() : \Phug\Parser\Node
setLastNode(\Phug\Parser\Node $last) : $this
\Phug\Parser\Node | $last |
getOuterNode() : \Phug\Parser\Node
setOuterNode(\Phug\Parser\Node $node) : $this
\Phug\Parser\Node | $node |
handleToken(\Phug\Lexer\TokenInterface $token = null) : $this
Handles any kind of token returned by the lexer.
The token handler is translated according to the token_handlers
option
If no token is passed, it will take the current token in the lexer's token generator
\Phug\Lexer\TokenInterface | $token | a token or the current lexer's generator token |
when no token handler has been found
expect(array $types) : \Phug\Parser\Node|null
Returns the token of the given type if it is in the token queue.
If the given token in the queue is not of the given type, this method returns null
array | $types | the types that are expected |
expectNext(array $types) : \Phug\Parser\Node|null
Moves the generator on by one and does ->expect().
array | $types | the types that are expected |
getToken() : \Phug\Lexer\TokenInterface|null
Returns the current token in the lexer generator.
getPreviousToken() : \Phug\Lexer\TokenInterface|null
Return the token parsed just before the current one (->getToken()).
is(\Phug\Parser\Node $node, array $classNames)
\Phug\Parser\Node | $node | |
array | $classNames |
createNode(string $className, \Phug\Lexer\TokenInterface $token = null) : \Phug\Parser\Node
Creates a new node instance with the given type.
If a token is given, the location in the code of that token is also passed to the Node instance
If no token is passed, a dummy-token with the current lexer's offset and line is created
Notice that nodes are expando-objects, you can add properties on-the-fly and retrieve them as an array later
string | $className | the type the node should have |
\Phug\Lexer\TokenInterface | $token | the token to relate this node to |
The newly created node
throwException(string $message, integer $code, \Phug\Lexer\TokenInterface $relatedToken = null, null $previous = null)
Throws a parser-exception.
The current line and offset of the exception get automatically appended to the message
string | $message | A meaningful error message |
integer | $code | |
\Phug\Lexer\TokenInterface | $relatedToken | |
null | $previous |
getNamedHandler(string $handler) : \Phug\Parser\TokenHandlerInterface
Instanciate a new handler by name or return the previous instancied one with the same name.
string | $handler | name |