1 | <?php |
||
35 | trait NodeTrait{ |
||
36 | |||
37 | /** |
||
38 | * @link http://api.prototypejs.org/dom/Element/recursivelyCollect/ |
||
39 | * |
||
40 | * @param string $property |
||
41 | * @param int $maxLength |
||
42 | * @param int $nodeType https://secure.php.net/manual/dom.constants.php |
||
43 | * |
||
44 | * @return \chillerlan\PrototypeDOM\NodeList |
||
45 | */ |
||
46 | public function recursivelyCollect(string $property, int $maxLength = -1, int $nodeType = \XML_ELEMENT_NODE):NodeList{ |
||
49 | |||
50 | /** |
||
51 | * @link http://api.prototypejs.org/dom/Element/empty/ |
||
52 | * |
||
53 | * @return bool |
||
54 | */ |
||
55 | public function empty():bool{ |
||
58 | |||
59 | /** |
||
60 | * @link http://api.prototypejs.org/dom/Element/inspect/ |
||
61 | * |
||
62 | * @param bool $xml |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function inspect(bool $xml = false):string{ |
||
69 | |||
70 | /** |
||
71 | * @link http://api.prototypejs.org/dom/Element/remove/ |
||
72 | * |
||
73 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
74 | */ |
||
75 | public function remove():PrototypeNode{ |
||
83 | |||
84 | /** |
||
85 | * @link http://api.prototypejs.org/dom/Element/replace/ |
||
86 | * |
||
87 | * @param \chillerlan\PrototypeDOM\Node\PrototypeNode $newnode |
||
88 | * |
||
89 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
90 | */ |
||
91 | public function replace(PrototypeNode $newnode):PrototypeNode{ |
||
99 | |||
100 | /** |
||
101 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
102 | */ |
||
103 | public function purge():PrototypeNode{ |
||
111 | |||
112 | /** |
||
113 | * @link http://api.prototypejs.org/dom/Element/cleanWhitespace/ |
||
114 | * |
||
115 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
116 | */ |
||
117 | public function cleanWhitespace():PrototypeNode{ |
||
132 | |||
133 | /** |
||
134 | * @param \chillerlan\PrototypeDOM\Node\PrototypeNode $newNode |
||
135 | * |
||
136 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
137 | */ |
||
138 | public function importNode(PrototypeNode $newNode):PrototypeNode{ |
||
141 | |||
142 | } |
||
143 |
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.