1 | <?php |
||
17 | trait ElementTrait{ |
||
18 | |||
19 | /** |
||
20 | * @link http://api.prototypejs.org/dom/Element/wrap/ |
||
21 | * |
||
22 | * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $wrapper |
||
23 | * |
||
24 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
25 | */ |
||
26 | public function wrap(PrototypeElement $wrapper):PrototypeElement{ |
||
29 | |||
30 | /** |
||
31 | * @link http://api.prototypejs.org/dom/Element/update/ |
||
32 | * |
||
33 | * @param string|\DOMNode|\DOMNodeList $content |
||
34 | * |
||
35 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
36 | */ |
||
37 | public function update($content):PrototypeElement{ |
||
40 | |||
41 | /** |
||
42 | * @link http://api.prototypejs.org/dom/Element/insert/ |
||
43 | * |
||
44 | * Accepted insertion points are: |
||
45 | * - before (as element's previous sibling) |
||
46 | * - after (as element's next sibling) |
||
47 | * - top (as element's first child) |
||
48 | * - bottom (as element's last child) |
||
49 | * |
||
50 | * @param string|array|\DOMNode|\DOMNodeList $content |
||
51 | * |
||
52 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
53 | */ |
||
54 | public function insert($content):PrototypeElement{ |
||
85 | |||
86 | /** |
||
87 | * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $node |
||
88 | * @param \chillerlan\PrototypeDOM\Node\PrototypeElement|null $refNode |
||
89 | * |
||
90 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
91 | */ |
||
92 | public function insert_before(PrototypeElement $node, PrototypeElement $refNode = null):PrototypeElement{ |
||
100 | |||
101 | /** |
||
102 | * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $node |
||
103 | * |
||
104 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
105 | */ |
||
106 | public function insert_after(PrototypeElement $node):PrototypeElement{ |
||
114 | |||
115 | /** |
||
116 | * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $node |
||
117 | * |
||
118 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
119 | */ |
||
120 | public function insert_top(PrototypeElement $node):PrototypeElement{ |
||
128 | |||
129 | /** |
||
130 | * @param \chillerlan\PrototypeDOM\Node\PrototypeElement $node |
||
131 | * |
||
132 | * @return \chillerlan\PrototypeDOM\Node\PrototypeElement |
||
133 | */ |
||
134 | public function insert_bottom(PrototypeElement $node):PrototypeElement{ |
||
139 | |||
140 | } |
||
141 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.