1 | <?php |
||
17 | class Writer { |
||
18 | |||
19 | /** |
||
20 | * @var string $indent The string to ident each level with. Default is a tab. |
||
21 | */ |
||
22 | public $indent = "\t"; |
||
23 | |||
24 | /** |
||
25 | * @var string $newLine The string to use as a new line or linebreak. Defaults to \r\n. |
||
26 | */ |
||
27 | public $newLine = "\r\n"; |
||
28 | |||
29 | /** |
||
30 | * @param array $options allows you to set the indent and newLine |
||
31 | * options immediately upon construction |
||
32 | */ |
||
33 | 1 | public function __construct( $options = []) |
|
42 | |||
43 | 2 | public function __call( $name, $args) |
|
47 | |||
48 | /** |
||
49 | * Returns a guaranteed valid XML name. Removes illegal characters from the name. |
||
50 | * @param string $name |
||
51 | * @return string |
||
52 | */ |
||
53 | 2 | public static function name( $name) |
|
59 | |||
60 | /** |
||
61 | * Returns a guaranteed valid XML attribute value. Removes illegal characters. |
||
62 | * @param string|array|bool $value |
||
63 | * @return string |
||
64 | */ |
||
65 | 3 | public static function value( $value) |
|
84 | |||
85 | /** |
||
86 | * Returns a guaranteed valid XML attribute. Removes illegal characters. |
||
87 | * @param string $name |
||
88 | * @param string|array|bool $value |
||
89 | * @return string |
||
90 | */ |
||
91 | 2 | public static function attribute( $name, $value) |
|
95 | |||
96 | /** |
||
97 | * Returns a guaranteed valid XML comment. Removes illegal characters. |
||
98 | * @param string $content |
||
99 | * @return string |
||
100 | */ |
||
101 | 1 | public static function comment( $content) |
|
105 | |||
106 | /** |
||
107 | * Returns a guaranteed valid XML CDATA string. Removes illegal characters. |
||
108 | * @param string $content |
||
109 | * @return string |
||
110 | */ |
||
111 | 1 | public static function cdata( $content) |
|
115 | |||
116 | /** |
||
117 | * Returns an XML preamble. |
||
118 | * @param string $version Defaults to '1.0' |
||
119 | * @param string $encoding Defaults to null |
||
120 | * @param string $standalone Defaults to null |
||
121 | * @return string |
||
122 | */ |
||
123 | 1 | public static function preamble( $version = '1.0', $encoding = null, $standalone = null) |
|
142 | } |
||
143 |