1 | <?php |
||
36 | trait NodeTrait{ |
||
37 | |||
38 | /** |
||
39 | * @link http://api.prototypejs.org/dom/Element/recursivelyCollect/ |
||
40 | * |
||
41 | * @param string $property |
||
42 | * @param int $maxLength |
||
43 | * @param int $nodeType |
||
44 | * |
||
45 | * @return \chillerlan\PrototypeDOM\NodeList |
||
46 | */ |
||
47 | 2 | public function recursivelyCollect(string $property, int $maxLength = -1, int $nodeType = XML_ELEMENT_NODE):NodeList{ |
|
50 | |||
51 | /** |
||
52 | * @link http://api.prototypejs.org/dom/Element/empty/ |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | 2 | public function empty():bool{ |
|
59 | |||
60 | /** |
||
61 | * @link http://api.prototypejs.org/dom/Element/inspect/ |
||
62 | * |
||
63 | * |
||
64 | * @todo: fixme! |
||
65 | * |
||
66 | * @param bool $xml |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | 3 | public function inspect($xml = false):string{ |
|
73 | |||
74 | /** |
||
75 | * @link http://api.prototypejs.org/dom/Element/remove/ |
||
76 | * |
||
77 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
78 | */ |
||
79 | 6 | public function remove():PrototypeNode{ |
|
87 | |||
88 | /** |
||
89 | * @link http://api.prototypejs.org/dom/Element/replace/ |
||
90 | * |
||
91 | * @param \chillerlan\PrototypeDOM\Node\PrototypeNode $newnode |
||
92 | * |
||
93 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
94 | */ |
||
95 | 2 | public function replace(PrototypeNode $newnode):PrototypeNode{ |
|
103 | |||
104 | /** |
||
105 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
106 | */ |
||
107 | 7 | public function purge():PrototypeNode{ |
|
115 | |||
116 | /** |
||
117 | * @link http://api.prototypejs.org/dom/Element/cleanWhitespace/ |
||
118 | * |
||
119 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
120 | */ |
||
121 | 1 | public function cleanWhitespace():PrototypeNode{ |
|
136 | |||
137 | /** |
||
138 | * @param \chillerlan\PrototypeDOM\Node\PrototypeNode $newNode |
||
139 | * |
||
140 | * @return \chillerlan\PrototypeDOM\Node\PrototypeNode |
||
141 | */ |
||
142 | 6 | public function _importNode(PrototypeNode $newNode):PrototypeNode{ |
|
145 | |||
146 | } |
||
147 |
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.