����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.148.227.92 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/./cbt.bofirm.com/vendor/voku/simple_html_dom/src/voku/helper/ |
Upload File : |
<?php declare(strict_types=1); namespace voku\helper; /** * {@inheritdoc} */ class SimpleXmlDomNode extends AbstractSimpleXmlDomNode implements SimpleXmlDomNodeInterface { /** * Find list of nodes with a CSS or xPath selector. * * @param string $selector * @param int|null $idx * * @return SimpleXmlDomNodeInterface<SimpleXmlDomInterface>|SimpleXmlDomNodeInterface[]|null */ public function find(string $selector, $idx = null) { // init $elements = new static(); foreach ($this as $node) { \assert($node instanceof SimpleXmlDomInterface); foreach ($node->find($selector) as $res) { $elements->append($res); } } // return all elements if ($idx === null) { if (\count($elements) === 0) { return new SimpleXmlDomNodeBlank(); } return $elements; } // handle negative values if ($idx < 0) { $idx = \count($elements) + $idx; } // return one element return $elements[$idx] ?? null; } /** * Find nodes with a CSS or xPath selector. * * @param string $selector * * @return SimpleXmlDomInterface[]|SimpleXmlDomNodeInterface<SimpleXmlDomInterface> */ public function findMulti(string $selector): SimpleXmlDomNodeInterface { return $this->find($selector, null); } /** * Find nodes with a CSS or xPath selector. * * @param string $selector * * @return false|SimpleXmlDomInterface[]|SimpleXmlDomNodeInterface<SimpleXmlDomInterface> */ public function findMultiOrFalse(string $selector) { $return = $this->find($selector, null); if ($return instanceof SimpleXmlDomNodeBlank) { return false; } return $return; } /** * Find one node with a CSS or xPath selector. * * @param string $selector * * @return SimpleXmlDomNodeInterface<SimpleXmlDomInterface> */ public function findOne(string $selector) { $return = $this->find($selector, 0); return $return ?? new SimpleXmlDomNodeBlank(); } /** * Find one node with a CSS or xPath selector or false, if no element is found. * * @param string $selector * * @return false|SimpleXmlDomNodeInterface<SimpleXmlDomInterface> */ public function findOneOrFalse(string $selector) { $return = $this->find($selector, 0); return $return ?? false; } /** * Get html of elements. * * @return string[] */ public function innerHtml(): array { // init $html = []; foreach ($this as $node) { $html[] = $node->outertext; } return $html; } /** * alias for "$this->innerHtml()" (added for compatibly-reasons with v1.x) * * @return string[] */ public function innertext() { return $this->innerHtml(); } /** * alias for "$this->innerHtml()" (added for compatibly-reasons with v1.x) * * @return string[] */ public function outertext() { return $this->innerHtml(); } /** * Get plain text. * * @return string[] */ public function text(): array { // init $text = []; foreach ($this as $node) { $text[] = $node->plaintext; } return $text; } }