[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php declare(strict_types=1); 2 3 namespace DOMWrap\Traits; 4 5 use DOMWrap\NodeList; 6 7 /** 8 * Node Trait 9 * 10 * @package DOMWrap\Traits 11 * @license http://opensource.org/licenses/BSD-3-Clause BSD 3 Clause 12 * @property \DOMDocument $ownerDocument 13 */ 14 trait NodeTrait 15 { 16 /** 17 * @return NodeList 18 */ 19 public function collection(): NodeList { 20 return $this->newNodeList([$this]); 21 } 22 23 /** 24 * @return \DOMDocument 25 */ 26 public function document(): ?\DOMDocument { 27 if ($this->isRemoved()) { 28 return null; 29 } 30 31 return $this->ownerDocument; 32 } 33 34 /** 35 * @param NodeList $nodeList 36 * 37 * @return NodeList|\DOMNode|null 38 */ 39 public function result(NodeList $nodeList) { 40 if ($nodeList->count()) { 41 return $nodeList->first(); 42 } 43 44 return null; 45 } 46 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body