annotate vendor/masterminds/html5/src/HTML5/Serializer/RulesInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
rev   line source
Chris@0 1 <?php
Chris@0 2 /**
Chris@0 3 * @file
Chris@0 4 * The interface definition for Rules to generate output.
Chris@0 5 */
Chris@0 6 namespace Masterminds\HTML5\Serializer;
Chris@0 7
Chris@0 8 /**
Chris@0 9 * To create a new rule set for writing output the RulesInterface needs to be
Chris@0 10 * implemented.
Chris@0 11 * The resulting class can be specified in the options with the
Chris@0 12 * key of rules.
Chris@0 13 *
Chris@0 14 * For an example implementation see \Masterminds\HTML5\Serializer\OutputRules.
Chris@0 15 */
Chris@0 16 interface RulesInterface
Chris@0 17 {
Chris@0 18
Chris@0 19 /**
Chris@0 20 * The class constructor.
Chris@0 21 *
Chris@0 22 * Note, before the rules can be used a traverser must be registered.
Chris@0 23 *
Chris@0 24 * @param mixed $output
Chris@0 25 * The output stream to write output to.
Chris@0 26 * @param array $options
Chris@0 27 * An array of options.
Chris@0 28 */
Chris@0 29 public function __construct($output, $options = array());
Chris@0 30
Chris@0 31 /**
Chris@0 32 * Register the traverser used in but the rules.
Chris@0 33 *
Chris@0 34 * Note, only one traverser can be used by the rules.
Chris@0 35 *
Chris@0 36 * @param \Masterminds\HTML5\Serializer\Traverser $traverser
Chris@0 37 * The traverser used in the rules.
Chris@0 38 * @return \Masterminds\HTML5\Serializer\RulesInterface $this for the current object.
Chris@0 39 */
Chris@0 40 public function setTraverser(\Masterminds\HTML5\Serializer\Traverser $traverser);
Chris@0 41
Chris@0 42 /**
Chris@0 43 * Write a document element (\DOMDocument).
Chris@0 44 *
Chris@0 45 * Instead of returning the result write it to the output stream ($output)
Chris@0 46 * that was passed into the constructor.
Chris@0 47 *
Chris@0 48 * @param \DOMDocument $dom
Chris@0 49 */
Chris@0 50 public function document($dom);
Chris@0 51
Chris@0 52 /**
Chris@0 53 * Write an element.
Chris@0 54 *
Chris@0 55 * Instead of returning the result write it to the output stream ($output)
Chris@0 56 * that was passed into the constructor.
Chris@0 57 *
Chris@0 58 * @param mixed $ele
Chris@0 59 */
Chris@0 60 public function element($ele);
Chris@0 61
Chris@0 62 /**
Chris@0 63 * Write a text node.
Chris@0 64 *
Chris@0 65 * Instead of returning the result write it to the output stream ($output)
Chris@0 66 * that was passed into the constructor.
Chris@0 67 *
Chris@0 68 * @param mixed $ele
Chris@0 69 */
Chris@0 70 public function text($ele);
Chris@0 71
Chris@0 72 /**
Chris@0 73 * Write a CDATA node.
Chris@0 74 *
Chris@0 75 * Instead of returning the result write it to the output stream ($output)
Chris@0 76 * that was passed into the constructor.
Chris@0 77 *
Chris@0 78 * @param mixed $ele
Chris@0 79 */
Chris@0 80 public function cdata($ele);
Chris@0 81
Chris@0 82 /**
Chris@0 83 * Write a comment node.
Chris@0 84 *
Chris@0 85 * Instead of returning the result write it to the output stream ($output)
Chris@0 86 * that was passed into the constructor.
Chris@0 87 *
Chris@0 88 * @param mixed $ele
Chris@0 89 */
Chris@0 90 public function comment($ele);
Chris@0 91
Chris@0 92 /**
Chris@0 93 * Write a processor instruction.
Chris@0 94 *
Chris@0 95 * To learn about processor instructions see \Masterminds\HTML5\InstructionProcessor
Chris@0 96 *
Chris@0 97 * Instead of returning the result write it to the output stream ($output)
Chris@0 98 * that was passed into the constructor.
Chris@0 99 *
Chris@0 100 * @param mixed $ele
Chris@0 101 */
Chris@0 102 public function processorInstruction($ele);
Chris@0 103 }