interface RulesInterface

To create a new rule set for writing output the RulesInterface needs to be implemented.

The resulting class can be specified in the options with the key of rules.

For an example implementation see \Masterminds\Html5\Serializer\OutputRules.

Methods

__construct( mixed $output, array $options = array())

The class constructor.

setTraverser( Traverser $traverser)

Register the traverser used in but the rules.

document( DOMDocument $dom)

Write a document element (\DOMDocument).

element( mixed $ele)

Write an element.

text( mixed $ele)

Write a text node.

cdata( mixed $ele)

Write a CDATA node.

comment( mixed $ele)

Write a comment node.

processorInstruction( mixed $ele)

Write a processor instruction.

Details

at line line 29
__construct( mixed $output, array $options = array())

The class constructor.

Note, before the rules can be used a traverser must be registered.

Parameters

mixed $output The output stream to write output to.
array $options An array of options.

at line line 40
RulesInterface setTraverser( Traverser $traverser)

Register the traverser used in but the rules.

Note, only one traverser can be used by the rules.

Parameters

Traverser $traverser The traverser used in the rules.

Return Value

RulesInterface $this for the current object.

at line line 50
document( DOMDocument $dom)

Write a document element (\DOMDocument).

Instead of returning the result write it to the output stream ($output) that was passed into the constructor.

Parameters

DOMDocument $dom

at line line 60
element( mixed $ele)

Write an element.

Instead of returning the result write it to the output stream ($output) that was passed into the constructor.

Parameters

mixed $ele

at line line 70
text( mixed $ele)

Write a text node.

Instead of returning the result write it to the output stream ($output) that was passed into the constructor.

Parameters

mixed $ele

at line line 80
cdata( mixed $ele)

Write a CDATA node.

Instead of returning the result write it to the output stream ($output) that was passed into the constructor.

Parameters

mixed $ele

at line line 90
comment( mixed $ele)

Write a comment node.

Instead of returning the result write it to the output stream ($output) that was passed into the constructor.

Parameters

mixed $ele

at line line 102
processorInstruction( mixed $ele)

Write a processor instruction.

To learn about processor instructions see \Masterminds\Html5\InstructionProcessor

Instead of returning the result write it to the output stream ($output) that was passed into the constructor.

Parameters

mixed $ele