1 | <?php |
||
18 | trait TraversalTrait{ |
||
19 | use NodeTrait; |
||
20 | |||
21 | /** |
||
22 | * @param $selector |
||
23 | * @param $index |
||
24 | * @param string $property |
||
25 | * @param int $nodeType |
||
26 | * |
||
27 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
||
28 | */ |
||
29 | 4 | public function _recursivelyFind($selector, $index, string $property, int $nodeType = XML_ELEMENT_NODE){ |
|
38 | |||
39 | /** |
||
40 | * @link http://api.prototypejs.org/dom/Element/select/ |
||
41 | * |
||
42 | * @param string|array $selectors |
||
43 | * |
||
44 | * @return \chillerlan\PrototypeDOM\NodeList |
||
45 | */ |
||
46 | 3 | public function select($selectors = null):NodeList{ |
|
49 | |||
50 | /** |
||
51 | * @link http://api.prototypejs.org/dom/Element/match/ |
||
52 | * |
||
53 | * @param string $selector |
||
54 | * |
||
55 | * @return bool |
||
56 | */ |
||
57 | 4 | public function match(string $selector):bool{ |
|
60 | |||
61 | /** |
||
62 | * @link http://api.prototypejs.org/dom/Element/down/ |
||
63 | * |
||
64 | * @param null $expression |
||
65 | * @param int $index |
||
66 | * |
||
67 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
||
68 | */ |
||
69 | 1 | public function down($expression = null, int $index = null){ |
|
85 | |||
86 | /** |
||
87 | * @link http://api.prototypejs.org/dom/Element/up/ |
||
88 | * |
||
89 | * @param string|null $expression |
||
90 | * @param int|null $index |
||
91 | * |
||
92 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
||
93 | */ |
||
94 | 2 | public function up($expression = null, int $index = null){ |
|
97 | |||
98 | /** |
||
99 | * @link http://api.prototypejs.org/dom/Element/previous/ |
||
100 | * |
||
101 | * @param string|null $expression |
||
102 | * @param int|null $index |
||
103 | * |
||
104 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
||
105 | */ |
||
106 | 1 | public function previous($expression = null, int $index = null){ |
|
109 | |||
110 | /** |
||
111 | * @link http://api.prototypejs.org/dom/Element/next/ |
||
112 | * |
||
113 | * @param string|null $expression |
||
114 | * @param int|null $index |
||
115 | * |
||
116 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode|null |
||
117 | */ |
||
118 | 2 | public function next($expression = null, int $index = null){ |
|
121 | |||
122 | /** |
||
123 | * @link http://api.prototypejs.org/dom/Element/childElements/ |
||
124 | * |
||
125 | * @param int $nodeType |
||
126 | * |
||
127 | * @return \chillerlan\PrototypeDOM\NodeList |
||
128 | */ |
||
129 | 2 | public function childElements(int $nodeType = XML_ELEMENT_NODE):NodeList{ |
|
146 | |||
147 | /** |
||
148 | * @link http://api.prototypejs.org/dom/Element/descendantOf/ |
||
149 | * |
||
150 | * @param \chillerlan\PrototypeDOM\Node\PrototypeNode $ancestor |
||
151 | * |
||
152 | * @return bool |
||
153 | */ |
||
154 | 1 | public function descendantOf(PrototypeNode $ancestor):bool{ |
|
157 | |||
158 | /** |
||
159 | * @link http://api.prototypejs.org/dom/Element/ancestors/ |
||
160 | * |
||
161 | * @return \chillerlan\PrototypeDOM\NodeList |
||
162 | */ |
||
163 | 2 | public function ancestors():NodeList{ |
|
166 | |||
167 | /** |
||
168 | * @link http://api.prototypejs.org/dom/Element/siblings/ |
||
169 | * |
||
170 | * @return \chillerlan\PrototypeDOM\NodeList |
||
171 | */ |
||
172 | 1 | public function siblings():NodeList{ |
|
175 | |||
176 | /** |
||
177 | * @link http://api.prototypejs.org/dom/Element/descendants/ |
||
178 | * |
||
179 | * @return \chillerlan\PrototypeDOM\NodeList |
||
180 | */ |
||
181 | 2 | public function descendants():NodeList{ |
|
184 | |||
185 | /** |
||
186 | * @link http://api.prototypejs.org/dom/Element/firstDescendant/ |
||
187 | * |
||
188 | * @return \chillerlan\PrototypeDOM\Node\Element|null |
||
189 | */ |
||
190 | 2 | public function firstDescendant(){ |
|
193 | |||
194 | /** |
||
195 | * @link http://api.prototypejs.org/dom/Element/previousSiblings/ |
||
196 | * |
||
197 | * @return \chillerlan\PrototypeDOM\NodeList |
||
198 | */ |
||
199 | 1 | public function previousSiblings():NodeList{ |
|
202 | |||
203 | /** |
||
204 | * @link http://api.prototypejs.org/dom/Element/nextSiblings/ |
||
205 | * |
||
206 | * @return \chillerlan\PrototypeDOM\NodeList |
||
207 | */ |
||
208 | 1 | public function nextSiblings():NodeList{ |
|
211 | |||
212 | } |
||
213 |
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.