@@ 5-62 (lines=58) @@ | ||
2 | ||
3 | namespace FluidXml; |
|
4 | ||
5 | trait FluidAliasesTrait |
|
6 | { |
|
7 | ||
8 | // Alias of ->length(). |
|
9 | public function size() |
|
10 | { |
|
11 | return $this->length(); |
|
12 | } |
|
13 | ||
14 | // Alias of ->query(). |
|
15 | public function __invoke(...$query) |
|
16 | { |
|
17 | return $this->query(...$query); |
|
18 | } |
|
19 | ||
20 | // Alias of ->addChild(). |
|
21 | public function add($child, ...$optionals) |
|
22 | { |
|
23 | return $this->addChild($child, ...$optionals); |
|
24 | } |
|
25 | ||
26 | // Alias of ->prependSibling(). |
|
27 | public function prepend($sibling, ...$optionals) |
|
28 | { |
|
29 | return $this->prependSibling($sibling, ...$optionals); |
|
30 | } |
|
31 | ||
32 | // Alias of ->appendSibling(). |
|
33 | public function append($sibling, ...$optionals) |
|
34 | { |
|
35 | return $this->appendSibling($sibling, ...$optionals); |
|
36 | } |
|
37 | ||
38 | // Alias of ->setAttribute(). |
|
39 | public function attr(...$arguments) |
|
40 | { |
|
41 | return $this->setAttribute(...$arguments); |
|
42 | } |
|
43 | ||
44 | // Alias of ->setText(). |
|
45 | public function text($text) |
|
46 | { |
|
47 | return $this->setText($text); |
|
48 | } |
|
49 | ||
50 | // Alias of ->setCdata(). |
|
51 | public function cdata($text) |
|
52 | { |
|
53 | return $this->setCdata($text); |
|
54 | } |
|
55 | ||
56 | // Alias of ->setComment(). |
|
57 | public function comment($text) |
|
58 | { |
|
59 | return $this->setComment($text); |
|
60 | } |
|
61 | ||
62 | } |
|
63 |
@@ 5-25 (lines=21) @@ | ||
2 | ||
3 | namespace FluidXml; |
|
4 | ||
5 | trait FluidAliasesTrait |
|
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); } |
|
16 | abstract public function length(); |
|
17 | abstract public function query(...$query); |
|
18 | abstract public function addChild($child, ...$optionals); |
|
19 | abstract public function prependSibling($sibling, ...$optionals); |
|
20 | abstract public function appendSibling($sibling, ...$optionals); |
|
21 | abstract public function setAttribute($name, $value = null); |
|
22 | abstract public function setText($text); |
|
23 | abstract public function setCdata($text); |
|
24 | abstract public function setComment($text); |
|
25 | } |
|
26 |