full-text-rss/libraries/html5php/HTML5/Serializer/RulesInterface.php

104 lines
2.7 KiB
PHP
Raw Normal View History

2014-09-15 22:24:06 +02:00
<?php
/**
* @file
* The interface definition for Rules to generate output.
*/
2015-06-14 02:03:20 +02:00
namespace Masterminds\HTML5\Serializer;
2014-09-15 22:24:06 +02:00
/**
* To create a new rule set for writing output the RulesInterface needs to be
2015-06-14 02:03:20 +02:00
* implemented.
* The resulting class can be specified in the options with the
2014-09-15 22:24:06 +02:00
* key of rules.
*
2015-06-14 02:03:20 +02:00
* For an example implementation see \Masterminds\HTML5\Serializer\OutputRules.
2014-09-15 22:24:06 +02:00
*/
2015-06-14 02:03:20 +02:00
interface RulesInterface
{
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* The class constructor.
*
* Note, before the rules can be used a traverser must be registered.
*
* @param mixed $output
* The output stream to write output to.
* @param array $options
* An array of options.
*/
public function __construct($output, $options = array());
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* Register the traverser used in but the rules.
*
* Note, only one traverser can be used by the rules.
*
* @param \Masterminds\HTML5\Serializer\Traverser $traverser
* The traverser used in the rules.
* @return \Masterminds\HTML5\Serializer\RulesInterface $this for the current object.
*/
public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser);
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* Write a document element (\DOMDocument).
*
* Instead of returning the result write it to the output stream ($output)
* that was passed into the constructor.
*
* @param \DOMDocument $dom
*/
public function document($dom);
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* Write an element.
*
* Instead of returning the result write it to the output stream ($output)
* that was passed into the constructor.
*
* @param mixed $ele
*/
public function element($ele);
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* Write a text node.
*
* Instead of returning the result write it to the output stream ($output)
* that was passed into the constructor.
*
* @param mixed $ele
*/
public function text($ele);
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* Write a CDATA node.
*
* Instead of returning the result write it to the output stream ($output)
* that was passed into the constructor.
*
* @param mixed $ele
*/
public function cdata($ele);
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* Write a comment node.
*
* Instead of returning the result write it to the output stream ($output)
* that was passed into the constructor.
*
* @param mixed $ele
*/
public function comment($ele);
2014-09-15 22:24:06 +02:00
2015-06-14 02:03:20 +02:00
/**
* 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.
*
* @param mixed $ele
*/
public function processorInstruction($ele);
}