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