@@ -4,15 +4,33 @@ |
||
4 | 4 | |
5 | 5 | trait FluidAliasesTrait |
6 | 6 | { |
7 | - public function size() { return $this->length(); } |
|
8 | - public function __invoke(...$query) { return $this->query(...$query); } |
|
9 | - public function add($child, ...$optionals) { return $this->addChild($child, ...$optionals); } |
|
10 | - public function prepend($sibling, ...$optionals) { return $this->prependSibling($sibling, ...$optionals); } |
|
11 | - public function append($sibling, ...$optionals) { return $this->appendSibling($sibling, ...$optionals); } |
|
12 | - public function attr($name, $value = null) { return $this->setAttribute($name, $value); } |
|
13 | - public function text($text) { return $this->setText($text); } |
|
14 | - public function cdata($text) { return $this->setCdata($text); } |
|
15 | - public function comment($text) { return $this->setComment($text); } |
|
7 | + public function size() |
|
8 | + { |
|
9 | +return $this->length(); } |
|
10 | + public function __invoke(...$query) |
|
11 | + { |
|
12 | +return $this->query(...$query); } |
|
13 | + public function add($child, ...$optionals) |
|
14 | + { |
|
15 | +return $this->addChild($child, ...$optionals); } |
|
16 | + public function prepend($sibling, ...$optionals) |
|
17 | + { |
|
18 | +return $this->prependSibling($sibling, ...$optionals); } |
|
19 | + public function append($sibling, ...$optionals) |
|
20 | + { |
|
21 | +return $this->appendSibling($sibling, ...$optionals); } |
|
22 | + public function attr($name, $value = null) |
|
23 | + { |
|
24 | +return $this->setAttribute($name, $value); } |
|
25 | + public function text($text) |
|
26 | + { |
|
27 | +return $this->setText($text); } |
|
28 | + public function cdata($text) |
|
29 | + { |
|
30 | +return $this->setCdata($text); } |
|
31 | + public function comment($text) |
|
32 | + { |
|
33 | +return $this->setComment($text); } |
|
16 | 34 | abstract public function length(); |
17 | 35 | abstract public function query(...$query); |
18 | 36 | abstract public function addChild($child, ...$optionals); |
@@ -8,10 +8,10 @@ |
||
8 | 8 | class FluidContext implements FluidInterface, \ArrayAccess, \Iterator |
9 | 9 | { |
10 | 10 | use FluidAliasesTrait, |
11 | - FluidSaveTrait, |
|
12 | - NewableTrait, |
|
13 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
14 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
11 | + FluidSaveTrait, |
|
12 | + NewableTrait, |
|
13 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
14 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
15 | 15 | |
16 | 16 | private $document; |
17 | 17 | private $handler; |
@@ -8,17 +8,17 @@ discard block |
||
8 | 8 | class FluidXml implements FluidInterface |
9 | 9 | { |
10 | 10 | use FluidAliasesTrait, |
11 | - FluidSaveTrait, |
|
12 | - NewableTrait, |
|
13 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
14 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
11 | + FluidSaveTrait, |
|
12 | + NewableTrait, |
|
13 | + ReservedCallTrait, // For compatibility with PHP 5.6. |
|
14 | + ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
15 | 15 | |
16 | 16 | const ROOT_NODE = 'doc'; |
17 | 17 | |
18 | 18 | private $defaults = [ 'root' => self::ROOT_NODE, |
19 | - 'version' => '1.0', |
|
20 | - 'encoding' => 'UTF-8', |
|
21 | - 'stylesheet' => null ]; |
|
19 | + 'version' => '1.0', |
|
20 | + 'encoding' => 'UTF-8', |
|
21 | + 'stylesheet' => null ]; |
|
22 | 22 | |
23 | 23 | private $document; |
24 | 24 | private $handler; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | // Now, we can further populate the DOM with any stylesheet or child. |
64 | 64 | $this->initStylesheet($options) |
65 | - ->initRoot($options); |
|
65 | + ->initRoot($options); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | protected function mergeOptions(&$arguments) |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | { |
98 | 98 | if (! empty($options['stylesheet'])) { |
99 | 99 | $attrs = 'type="text/xsl" ' |
100 | - . "encoding=\"{$options['encoding']}\" " |
|
101 | - . 'indent="yes" ' |
|
102 | - . "href=\"{$options['stylesheet']}\""; |
|
100 | + . "encoding=\"{$options['encoding']}\" " |
|
101 | + . 'indent="yes" ' |
|
102 | + . "href=\"{$options['stylesheet']}\""; |
|
103 | 103 | |
104 | 104 | $stylesheet = new \DOMProcessingInstruction('xml-stylesheet', $attrs); |
105 | 105 |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | $namespaces[] = new FluidNamespace(...$args); |
196 | - } elseif (\is_array($arguments[0])) { |
|
196 | + } elseif (\is_array($arguments[0])) { |
|
197 | 197 | $namespaces = $arguments[0]; |
198 | 198 | } else { |
199 | 199 | $namespaces = $arguments; |
@@ -207,18 +207,42 @@ discard block |
||
207 | 207 | return $this; |
208 | 208 | } |
209 | 209 | |
210 | - public function query(...$query) { return $this->context()->query(...$query); } |
|
211 | - public function times($times, callable $fn = null) { return $this->context()->times($times, $fn); } |
|
212 | - public function each(callable $fn) { return $this->context()->each($fn); } |
|
213 | - public function filter(callable $fn) { return $this->context()->filter($fn); } |
|
214 | - public function setAttribute($name, $value = null) { $this->context()->setAttribute($name, $value); return $this; } |
|
215 | - public function setText($text) { $this->context()->setText($text); return $this; } |
|
216 | - public function addText($text) { $this->context()->addText($text); return $this; } |
|
217 | - public function setCdata($text) { $this->context()->setCdata($text); return $this; } |
|
218 | - public function addCdata($text) { $this->context()->addCdata($text); return $this; } |
|
219 | - public function setComment($text) { $this->context()->setComment($text); return $this; } |
|
220 | - public function addComment($text) { $this->context()->addComment($text); return $this; } |
|
221 | - public function remove(...$query) { $this->context()->remove(...$query); return $this; } |
|
210 | + public function query(...$query) |
|
211 | + { |
|
212 | +return $this->context()->query(...$query); } |
|
213 | + public function times($times, callable $fn = null) |
|
214 | + { |
|
215 | +return $this->context()->times($times, $fn); } |
|
216 | + public function each(callable $fn) |
|
217 | + { |
|
218 | +return $this->context()->each($fn); } |
|
219 | + public function filter(callable $fn) |
|
220 | + { |
|
221 | +return $this->context()->filter($fn); } |
|
222 | + public function setAttribute($name, $value = null) |
|
223 | + { |
|
224 | +$this->context()->setAttribute($name, $value); return $this; } |
|
225 | + public function setText($text) |
|
226 | + { |
|
227 | +$this->context()->setText($text); return $this; } |
|
228 | + public function addText($text) |
|
229 | + { |
|
230 | +$this->context()->addText($text); return $this; } |
|
231 | + public function setCdata($text) |
|
232 | + { |
|
233 | +$this->context()->setCdata($text); return $this; } |
|
234 | + public function addCdata($text) |
|
235 | + { |
|
236 | +$this->context()->addCdata($text); return $this; } |
|
237 | + public function setComment($text) |
|
238 | + { |
|
239 | +$this->context()->setComment($text); return $this; } |
|
240 | + public function addComment($text) |
|
241 | + { |
|
242 | +$this->context()->addComment($text); return $this; } |
|
243 | + public function remove(...$query) |
|
244 | + { |
|
245 | +$this->context()->remove(...$query); return $this; } |
|
222 | 246 | |
223 | 247 | public function addChild($child, ...$optionals) |
224 | 248 | { |