@@ -206,18 +206,42 @@ |
||
| 206 | 206 | return $this; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function query(...$query) { return $this->context()->query(...$query); } |
|
| 210 | - public function times($times, callable $fn = null) { return $this->context()->times($times, $fn); } |
|
| 211 | - public function each(callable $fn) { return $this->context()->each($fn); } |
|
| 212 | - public function filter(callable $fn) { return $this->context()->filter($fn); } |
|
| 213 | - public function setAttribute($name, $value = null) { $this->context()->setAttribute($name, $value); return $this; } |
|
| 214 | - public function setText($text) { $this->context()->setText($text); return $this; } |
|
| 215 | - public function addText($text) { $this->context()->addText($text); return $this; } |
|
| 216 | - public function setCdata($text) { $this->context()->setCdata($text); return $this; } |
|
| 217 | - public function addCdata($text) { $this->context()->addCdata($text); return $this; } |
|
| 218 | - public function setComment($text) { $this->context()->setComment($text); return $this; } |
|
| 219 | - public function addComment($text) { $this->context()->addComment($text); return $this; } |
|
| 220 | - public function remove(...$query) { $this->context()->remove(...$query); return $this; } |
|
| 209 | + public function query(...$query) |
|
| 210 | + { |
|
| 211 | +return $this->context()->query(...$query); } |
|
| 212 | + public function times($times, callable $fn = null) |
|
| 213 | + { |
|
| 214 | +return $this->context()->times($times, $fn); } |
|
| 215 | + public function each(callable $fn) |
|
| 216 | + { |
|
| 217 | +return $this->context()->each($fn); } |
|
| 218 | + public function filter(callable $fn) |
|
| 219 | + { |
|
| 220 | +return $this->context()->filter($fn); } |
|
| 221 | + public function setAttribute($name, $value = null) |
|
| 222 | + { |
|
| 223 | +$this->context()->setAttribute($name, $value); return $this; } |
|
| 224 | + public function setText($text) |
|
| 225 | + { |
|
| 226 | +$this->context()->setText($text); return $this; } |
|
| 227 | + public function addText($text) |
|
| 228 | + { |
|
| 229 | +$this->context()->addText($text); return $this; } |
|
| 230 | + public function setCdata($text) |
|
| 231 | + { |
|
| 232 | +$this->context()->setCdata($text); return $this; } |
|
| 233 | + public function addCdata($text) |
|
| 234 | + { |
|
| 235 | +$this->context()->addCdata($text); return $this; } |
|
| 236 | + public function setComment($text) |
|
| 237 | + { |
|
| 238 | +$this->context()->setComment($text); return $this; } |
|
| 239 | + public function addComment($text) |
|
| 240 | + { |
|
| 241 | +$this->context()->addComment($text); return $this; } |
|
| 242 | + public function remove(...$query) |
|
| 243 | + { |
|
| 244 | +$this->context()->remove(...$query); return $this; } |
|
| 221 | 245 | |
| 222 | 246 | public function addChild($child, ...$optionals) |
| 223 | 247 | { |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | use FluidAliasesTrait, |
| 11 | 11 | FluidSaveTrait, |
| 12 | 12 | NewableTrait, |
| 13 | - ReservedCallTrait, // For compatibility with PHP 5.6. |
|
| 14 | - ReservedCallStaticTrait; // For compatibility with PHP 5.6. |
|
| 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; |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | $this->document = $document; |
| 24 | 24 | $this->handler = $handler; |
| 25 | 25 | |
| 26 | - if (! \is_array($context) && ! $context instanceof \Traversable) { |
|
| 26 | + if (!\is_array($context) && !$context instanceof \Traversable) { |
|
| 27 | 27 | // DOMDocument, DOMElement and DOMNode are not iterable. |
| 28 | 28 | // DOMNodeList and FluidContext are iterable. |
| 29 | - $context = [ $context ]; |
|
| 29 | + $context = [$context]; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | foreach ($context as $n) { |
| 33 | - if (! $n instanceof \DOMNode) { |
|
| 33 | + if (!$n instanceof \DOMNode) { |
|
| 34 | 34 | throw new \Exception('Node type not recognized.'); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -199,14 +199,14 @@ discard block |
||
| 199 | 199 | // addChild($child, $value?, $attributes? = [], $switchContext? = false) |
| 200 | 200 | public function addChild($child, ...$optionals) |
| 201 | 201 | { |
| 202 | - return $this->handler->insertElement($this->nodes, $child, $optionals, function ($parent, $element) { |
|
| 202 | + return $this->handler->insertElement($this->nodes, $child, $optionals, function($parent, $element) { |
|
| 203 | 203 | return $parent->appendChild($element); |
| 204 | 204 | }, $this); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public function prependSibling($sibling, ...$optionals) |
| 208 | 208 | { |
| 209 | - return $this->handler->insertElement($this->nodes, $sibling, $optionals, function ($sibling, $element) { |
|
| 209 | + return $this->handler->insertElement($this->nodes, $sibling, $optionals, function($sibling, $element) { |
|
| 210 | 210 | if ($sibling->parentNode === null) { |
| 211 | 211 | // If the node doesn't have at least one parent node, |
| 212 | 212 | // the sibling creation fails. In this case we replace |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | public function appendSibling($sibling, ...$optionals) |
| 223 | 223 | { |
| 224 | - return $this->handler->insertElement($this->nodes, $sibling, $optionals, function ($sibling, $element) { |
|
| 224 | + return $this->handler->insertElement($this->nodes, $sibling, $optionals, function($sibling, $element) { |
|
| 225 | 225 | if ($sibling->parentNode === null) { |
| 226 | 226 | // If the node doesn't have at least one parent node, |
| 227 | 227 | // the sibling creation fails. In this case we replace |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | if (\is_array($name)) { |
| 243 | 243 | $attrs = $name; |
| 244 | 244 | } else { |
| 245 | - $attrs = [ $name => $value ]; |
|
| 245 | + $attrs = [$name => $value]; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | foreach ($this->nodes as $n) { |
@@ -394,10 +394,10 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | protected function resolveQuery($query) |
| 396 | 396 | { |
| 397 | - if ( $query === '.' |
|
| 397 | + if ($query === '.' |
|
| 398 | 398 | || $query[0] === '/' |
| 399 | - || ( $query[0] === '.' && $query[1] === '/' ) |
|
| 400 | - || ( $query[0] === '.' && $query[1] === '.' ) ) { |
|
| 399 | + || ($query[0] === '.' && $query[1] === '/') |
|
| 400 | + || ($query[0] === '.' && $query[1] === '.')) { |
|
| 401 | 401 | return $query; |
| 402 | 402 | } |
| 403 | 403 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | $found = ($r === $u) || $found; |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if (! $found) { |
|
| 418 | + if (!$found) { |
|
| 419 | 419 | $set[] = $r; |
| 420 | 420 | } |
| 421 | 421 | } |