%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11585/cwd/html/egp/vendor/codeception/codeception/src/Codeception/Util/ |
Upload File : |
<?php namespace Codeception\Util; use Codeception\Exception\ElementNotFound; use Codeception\Exception\MalformedLocatorException; use Symfony\Component\CssSelector\CssSelectorConverter; use Symfony\Component\CssSelector\Exception\ParseException; use Codeception\Util\Soap as XmlUtils; class XmlStructure { /** * @var \DOMDocument|\DOMNode */ protected $xml; public function __construct($xml) { $this->xml = XmlUtils::toXml($xml); } public function matchesXpath($xpath) { $path = new \DOMXPath($this->xml); $res = $path->query($xpath); if ($res === false) { throw new MalformedLocatorException($xpath); } return $res->length > 0; } /** * @param $cssOrXPath * @return \DOMElement */ public function matchElement($cssOrXPath) { $xpath = new \DOMXpath($this->xml); try { $selector = (new CssSelectorConverter())->toXPath($cssOrXPath); $els = $xpath->query($selector); if ($els) { return $els->item(0); } } catch (ParseException $e) { } $els = $xpath->query($cssOrXPath); if ($els->length) { return $els->item(0); } throw new ElementNotFound($cssOrXPath); } /** * @param $xml * @return bool */ public function matchXmlStructure($xml) { $xml = XmlUtils::toXml($xml); $root = $xml->firstChild; $els = $this->xml->getElementsByTagName($root->nodeName); if (empty($els)) { throw new ElementNotFound($root->nodeName, 'Element'); } $matches = false; foreach ($els as $node) { $matches |= $this->matchForNode($root, $node); } return $matches; } protected function matchForNode($schema, $xml) { foreach ($schema->childNodes as $node1) { $matched = false; foreach ($xml->childNodes as $node2) { if ($node1->nodeName == $node2->nodeName) { $matched = $this->matchForNode($node1, $node2); if ($matched) { break; } } } if (!$matched) { return false; } } return true; } }