RulesInterface
in
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 Serializer\OutputRules.
Table of Contents
Methods
- __construct() : mixed
- The class constructor.
- cdata() : mixed
- Write a CDATA node.
- comment() : mixed
- Write a comment node.
- document() : mixed
- Write a document element (\DOMDocument).
- element() : mixed
- Write an element.
- processorInstruction() : mixed
- Write a processor instruction.
- setTraverser() : RulesInterface
- Register the traverser used in but the rules.
- text() : mixed
- Write a text node.
Methods
__construct()
The class constructor.
public
__construct(mixed $output[, array<string|int, mixed> $options = array() ]) : mixed
Note, before the rules can be used a traverser must be registered.
Parameters
- $output : mixed
-
The output stream to write output to.
- $options : array<string|int, mixed> = array()
-
An array of options.
cdata()
Write a CDATA node.
public
cdata(mixed $ele) : mixed
Instead of returning the result write it to the output stream ($output) that was passed into the constructor.
Parameters
- $ele : mixed
comment()
Write a comment node.
public
comment(mixed $ele) : mixed
Instead of returning the result write it to the output stream ($output) that was passed into the constructor.
Parameters
- $ele : mixed
document()
Write a document element (\DOMDocument).
public
document(DOMDocument $dom) : mixed
Instead of returning the result write it to the output stream ($output) that was passed into the constructor.
Parameters
- $dom : DOMDocument
element()
Write an element.
public
element(mixed $ele) : mixed
Instead of returning the result write it to the output stream ($output) that was passed into the constructor.
Parameters
- $ele : mixed
processorInstruction()
Write a processor instruction.
public
processorInstruction(mixed $ele) : mixed
To learn about processor instructions see InstructionProcessor
Instead of returning the result write it to the output stream ($output) that was passed into the constructor.
Parameters
- $ele : mixed
setTraverser()
Register the traverser used in but the rules.
public
setTraverser(Traverser $traverser) : RulesInterface
Note, only one traverser can be used by the rules.
Parameters
- $traverser : Traverser
-
The traverser used in the rules.
Return values
RulesInterface —$this for the current object.
text()
Write a text node.
public
text(mixed $ele) : mixed
Instead of returning the result write it to the output stream ($output) that was passed into the constructor.
Parameters
- $ele : mixed