Merge pull request #4036 from dokuwiki/issue4033
[dokuwiki.git] / _test / vendor / scotteh / php-dom-wrapper / src / Traits / NodeTrait.php
blob92d2f57a1c8d83dfc5496dac16f8c6350ccccb1f
1 <?php declare(strict_types=1);
3 namespace DOMWrap\Traits;
5 use DOMWrap\NodeList;
7 /**
8 * Node Trait
10 * @package DOMWrap\Traits
11 * @license http://opensource.org/licenses/BSD-3-Clause BSD 3 Clause
12 * @property \DOMDocument $ownerDocument
14 trait NodeTrait
16 /**
17 * @return NodeList
19 public function collection(): NodeList {
20 return $this->newNodeList([$this]);
23 /**
24 * @return \DOMDocument
26 public function document(): ?\DOMDocument {
27 if ($this->isRemoved()) {
28 return null;
31 return $this->ownerDocument;
34 /**
35 * @param NodeList $nodeList
37 * @return NodeList|\DOMNode|null
39 public function result(NodeList $nodeList) {
40 if ($nodeList->count()) {
41 return $nodeList->first();
44 return null;