1 | <?php |
||
21 | trait PrototypeTraversalTrait{ |
||
22 | use PrototypeNodeTrait; |
||
23 | |||
24 | /** |
||
25 | * @param $selector |
||
26 | * @param $index |
||
27 | * @param string $property |
||
28 | * @param int $nodeType https://secure.php.net/manual/dom.constants.php |
||
29 | * |
||
30 | * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|\DOMNode|null |
||
31 | */ |
||
32 | public function recursivelyFind($selector, int $index = null, string $property = null, int $nodeType = \XML_ELEMENT_NODE):?PrototypeTraversal{ |
||
40 | |||
41 | /** |
||
42 | * @link http://api.prototypejs.org/dom/Element/select/ |
||
43 | * |
||
44 | * @param array $selectors |
||
45 | * |
||
46 | * @return \chillerlan\PrototypeDOM\NodeList |
||
47 | */ |
||
48 | public function select(array $selectors = null):NodeList{ |
||
51 | |||
52 | /** |
||
53 | * @link http://api.prototypejs.org/dom/Element/match/ |
||
54 | * |
||
55 | * @param string $selector |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | public function match(string $selector):bool{ |
||
62 | |||
63 | /** |
||
64 | * @link http://api.prototypejs.org/dom/Element/down/ |
||
65 | * |
||
66 | * @param null $expression |
||
67 | * @param int $index |
||
68 | * |
||
69 | * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null |
||
70 | */ |
||
71 | public function down($expression = null, int $index = null):?PrototypeTraversal{ |
||
89 | |||
90 | /** |
||
91 | * @link http://api.prototypejs.org/dom/Element/up/ |
||
92 | * |
||
93 | * @param string|null $expression |
||
94 | * @param int|null $index |
||
95 | * |
||
96 | * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null |
||
97 | */ |
||
98 | public function up($expression = null, int $index = null):?PrototypeTraversal{ |
||
101 | |||
102 | /** |
||
103 | * @link http://api.prototypejs.org/dom/Element/previous/ |
||
104 | * |
||
105 | * @param string|null $expression |
||
106 | * @param int|null $index |
||
107 | * |
||
108 | * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null |
||
109 | */ |
||
110 | public function previous($expression = null, int $index = null):?PrototypeTraversal{ |
||
113 | |||
114 | /** |
||
115 | * @link http://api.prototypejs.org/dom/Element/next/ |
||
116 | * |
||
117 | * @param string|null $expression |
||
118 | * @param int|null $index |
||
119 | * |
||
120 | * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null |
||
121 | */ |
||
122 | public function next($expression = null, int $index = null):?PrototypeTraversal{ |
||
125 | |||
126 | /** |
||
127 | * @link http://api.prototypejs.org/dom/Element/childElements/ |
||
128 | * |
||
129 | * @param int $nodeType https://secure.php.net/manual/dom.constants.php |
||
130 | * |
||
131 | * @return \chillerlan\PrototypeDOM\NodeList |
||
132 | */ |
||
133 | public function childElements(int $nodeType = \XML_ELEMENT_NODE):NodeList{ |
||
150 | |||
151 | /** |
||
152 | * @link http://api.prototypejs.org/dom/Element/descendantOf/ |
||
153 | * |
||
154 | * @param \DOMNode $ancestor |
||
155 | * |
||
156 | * @return bool |
||
157 | */ |
||
158 | public function descendantOf(DOMNode $ancestor):bool{ |
||
161 | |||
162 | /** |
||
163 | * @link http://api.prototypejs.org/dom/Element/ancestors/ |
||
164 | * |
||
165 | * @return \chillerlan\PrototypeDOM\NodeList |
||
166 | */ |
||
167 | public function ancestors():NodeList{ |
||
170 | |||
171 | /** |
||
172 | * @link http://api.prototypejs.org/dom/Element/siblings/ |
||
173 | * |
||
174 | * @return \chillerlan\PrototypeDOM\NodeList |
||
175 | */ |
||
176 | public function siblings():NodeList{ |
||
179 | |||
180 | /** |
||
181 | * @link http://api.prototypejs.org/dom/Element/descendants/ |
||
182 | * |
||
183 | * @return \chillerlan\PrototypeDOM\NodeList |
||
184 | */ |
||
185 | public function descendants():NodeList{ |
||
188 | |||
189 | /** |
||
190 | * @link http://api.prototypejs.org/dom/Element/firstDescendant/ |
||
191 | * |
||
192 | * @return \chillerlan\PrototypeDOM\Node\PrototypeTraversal|null |
||
193 | */ |
||
194 | public function firstDescendant():?PrototypeTraversal{ |
||
197 | |||
198 | /** |
||
199 | * @link http://api.prototypejs.org/dom/Element/previousSiblings/ |
||
200 | * |
||
201 | * @return \chillerlan\PrototypeDOM\NodeList |
||
202 | */ |
||
203 | public function previousSiblings():NodeList{ |
||
206 | |||
207 | /** |
||
208 | * @link http://api.prototypejs.org/dom/Element/nextSiblings/ |
||
209 | * |
||
210 | * @return \chillerlan\PrototypeDOM\NodeList |
||
211 | */ |
||
212 | public function nextSiblings():NodeList{ |
||
215 | |||
216 | } |
||
217 |
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.