@@ -107,34 +107,34 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * Evaluate and return the result of a given XPath expression using this element as context node |
|
| 111 | - * |
|
| 112 | - * @param string $expr XPath expression |
|
| 113 | - * @return mixed |
|
| 114 | - */ |
|
| 110 | + * Evaluate and return the result of a given XPath expression using this element as context node |
|
| 111 | + * |
|
| 112 | + * @param string $expr XPath expression |
|
| 113 | + * @return mixed |
|
| 114 | + */ |
|
| 115 | 115 | public function evaluate(string $expr) |
| 116 | 116 | { |
| 117 | 117 | return $this->ownerDocument->evaluate($expr, $this); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | - * Evaluate and return the first element of a given XPath query using this element as context node |
|
| 122 | - * |
|
| 123 | - * @param string $expr XPath expression |
|
| 124 | - * @return DOMNode|null |
|
| 125 | - */ |
|
| 121 | + * Evaluate and return the first element of a given XPath query using this element as context node |
|
| 122 | + * |
|
| 123 | + * @param string $expr XPath expression |
|
| 124 | + * @return DOMNode|null |
|
| 125 | + */ |
|
| 126 | 126 | public function firstOf(string $expr): ?DOMNode |
| 127 | 127 | { |
| 128 | 128 | return $this->ownerDocument->firstOf($expr, $this); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Insert given element relative to this element's position |
|
| 133 | - * |
|
| 134 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 135 | - * @param self $element |
|
| 136 | - * @return self |
|
| 137 | - */ |
|
| 132 | + * Insert given element relative to this element's position |
|
| 133 | + * |
|
| 134 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 135 | + * @param self $element |
|
| 136 | + * @return self |
|
| 137 | + */ |
|
| 138 | 138 | public function insertAdjacentElement(string $where, self $element): self |
| 139 | 139 | { |
| 140 | 140 | $this->insertAdjacentNode($where, $element); |
@@ -143,24 +143,24 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | - * Insert given text relative to this element's position |
|
| 147 | - * |
|
| 148 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 149 | - * @param string $text |
|
| 150 | - * @return void |
|
| 151 | - */ |
|
| 146 | + * Insert given text relative to this element's position |
|
| 147 | + * |
|
| 148 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 149 | + * @param string $text |
|
| 150 | + * @return void |
|
| 151 | + */ |
|
| 152 | 152 | public function insertAdjacentText(string $where, string $text): void |
| 153 | 153 | { |
| 154 | 154 | $this->insertText($where, $text); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * Insert given XML relative to this element's position |
|
| 159 | - * |
|
| 160 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 161 | - * @param string $xml |
|
| 162 | - * @return void |
|
| 163 | - */ |
|
| 158 | + * Insert given XML relative to this element's position |
|
| 159 | + * |
|
| 160 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 161 | + * @param string $xml |
|
| 162 | + * @return void |
|
| 163 | + */ |
|
| 164 | 164 | public function insertAdjacentXML(string $where, string $xml): void |
| 165 | 165 | { |
| 166 | 166 | $fragment = $this->ownerDocument->createDocumentFragment(); |
@@ -170,32 +170,32 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | - * Evaluate and return the result of a given XPath query using this element as context node |
|
| 174 | - * |
|
| 175 | - * @param string $expr XPath expression |
|
| 176 | - * @return DOMNodeList |
|
| 177 | - */ |
|
| 173 | + * Evaluate and return the result of a given XPath query using this element as context node |
|
| 174 | + * |
|
| 175 | + * @param string $expr XPath expression |
|
| 176 | + * @return DOMNodeList |
|
| 177 | + */ |
|
| 178 | 178 | public function query(string $expr): DOMNodeList |
| 179 | 179 | { |
| 180 | 180 | return $this->ownerDocument->query($expr, $this); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | - * Remove this element from the document |
|
| 185 | - * |
|
| 186 | - * @return void |
|
| 187 | - */ |
|
| 184 | + * Remove this element from the document |
|
| 185 | + * |
|
| 186 | + * @return void |
|
| 187 | + */ |
|
| 188 | 188 | public function remove(): void |
| 189 | 189 | { |
| 190 | 190 | $this->parentNode->removeChild($this); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * Replace this element with given nodes/text |
|
| 195 | - * |
|
| 196 | - * @param DOMNode|string $nodes |
|
| 197 | - * @return void |
|
| 198 | - */ |
|
| 194 | + * Replace this element with given nodes/text |
|
| 195 | + * |
|
| 196 | + * @param DOMNode|string $nodes |
|
| 197 | + * @return void |
|
| 198 | + */ |
|
| 199 | 199 | public function replaceWith(...$nodes): void |
| 200 | 200 | { |
| 201 | 201 | foreach ($nodes as $node) |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | - * Add namespace declarations that may be missing in given XML |
|
| 214 | - * |
|
| 215 | - * @param string $xml Original XML |
|
| 216 | - * @return string Modified XML |
|
| 217 | - */ |
|
| 213 | + * Add namespace declarations that may be missing in given XML |
|
| 214 | + * |
|
| 215 | + * @param string $xml Original XML |
|
| 216 | + * @return string Modified XML |
|
| 217 | + */ |
|
| 218 | 218 | protected function addMissingNamespaceDeclarations(string $xml): string |
| 219 | 219 | { |
| 220 | 220 | preg_match_all('(xmlns:\\K[-\\w]++(?==))', $xml, $m); |
@@ -239,12 +239,12 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | - * Insert given node relative to this element's position |
|
| 243 | - * |
|
| 244 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 245 | - * @param DOMNode $node |
|
| 246 | - * @return void |
|
| 247 | - */ |
|
| 242 | + * Insert given node relative to this element's position |
|
| 243 | + * |
|
| 244 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 245 | + * @param DOMNode $node |
|
| 246 | + * @return void |
|
| 247 | + */ |
|
| 248 | 248 | protected function insertAdjacentNode(string $where, DOMNode $node): void |
| 249 | 249 | { |
| 250 | 250 | $where = strtolower($where); |
@@ -271,13 +271,13 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
| 274 | - * Create and insert an element at given position |
|
| 275 | - * |
|
| 276 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 277 | - * @param string $nodeName Element's nodeName |
|
| 278 | - * @param string $text Text content |
|
| 279 | - * @return self |
|
| 280 | - */ |
|
| 274 | + * Create and insert an element at given position |
|
| 275 | + * |
|
| 276 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 277 | + * @param string $nodeName Element's nodeName |
|
| 278 | + * @param string $text Text content |
|
| 279 | + * @return self |
|
| 280 | + */ |
|
| 281 | 281 | protected function insertElement(string $where, string $nodeName, string $text): self |
| 282 | 282 | { |
| 283 | 283 | $text = htmlspecialchars($text, ENT_NOQUOTES); |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | - * Insert given text relative to this element's position |
|
| 301 | - * |
|
| 302 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 303 | - * @param string $text |
|
| 304 | - * @return DOMText |
|
| 305 | - */ |
|
| 300 | + * Insert given text relative to this element's position |
|
| 301 | + * |
|
| 302 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 303 | + * @param string $text |
|
| 304 | + * @return DOMText |
|
| 305 | + */ |
|
| 306 | 306 | protected function insertText(string $where, string $text): DOMText |
| 307 | 307 | { |
| 308 | 308 | $node = $this->ownerDocument->createTextNode($text); |
@@ -312,13 +312,13 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | /** |
| 315 | - * Create and insert an XSL element at given position |
|
| 316 | - * |
|
| 317 | - * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 318 | - * @param string $localName Element's localName |
|
| 319 | - * @param array $arguments Arguments passed to the Document::create* function |
|
| 320 | - * @return self |
|
| 321 | - */ |
|
| 315 | + * Create and insert an XSL element at given position |
|
| 316 | + * |
|
| 317 | + * @param string $where One of 'beforebegin', 'afterbegin', 'beforeend', 'afterend' |
|
| 318 | + * @param string $localName Element's localName |
|
| 319 | + * @param array $arguments Arguments passed to the Document::create* function |
|
| 320 | + * @return self |
|
| 321 | + */ |
|
| 322 | 322 | protected function insertXslElement(string $where, string $localName, array $arguments): self |
| 323 | 323 | { |
| 324 | 324 | $callback = [$this->ownerDocument, 'createXsl' . ucfirst($localName)]; |