X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fdom-crawler%2FCrawler.php;fp=vendor%2Fsymfony%2Fdom-crawler%2FCrawler.php;h=a3228d1bab6c2ed83d86e1245e880c09849349c6;hp=c640fa425daa988078d12d590896c6bede5935ec;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/vendor/symfony/dom-crawler/Crawler.php b/vendor/symfony/dom-crawler/Crawler.php index c640fa425..a3228d1ba 100644 --- a/vendor/symfony/dom-crawler/Crawler.php +++ b/vendor/symfony/dom-crawler/Crawler.php @@ -112,12 +112,12 @@ class Crawler implements \Countable, \IteratorAggregate $this->addNodeList($node); } elseif ($node instanceof \DOMNode) { $this->addNode($node); - } elseif (is_array($node)) { + } elseif (\is_array($node)) { $this->addNodes($node); - } elseif (is_string($node)) { + } elseif (\is_string($node)) { $this->addContent($node); } elseif (null !== $node) { - throw new \InvalidArgumentException(sprintf('Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "%s".', is_object($node) ? get_class($node) : gettype($node))); + throw new \InvalidArgumentException(sprintf('Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "%s".', \is_object($node) ? \get_class($node) : \gettype($node))); } } @@ -129,7 +129,7 @@ class Crawler implements \Countable, \IteratorAggregate * HTTP 1.1 specification. * * @param string $content A string to parse as HTML/XML - * @param null|string $type The content type of the string + * @param string|null $type The content type of the string */ public function addContent($content, $type = null) { @@ -211,7 +211,7 @@ class Crawler implements \Countable, \IteratorAggregate $base = $this->filterRelativeXPath('descendant-or-self::base')->extract(array('href')); $baseHref = current($base); - if (count($base) && !empty($baseHref)) { + if (\count($base) && !empty($baseHref)) { if ($this->baseHref) { $linkNode = $dom->createElement('a'); $linkNode->setAttribute('href', $baseHref); @@ -322,7 +322,7 @@ class Crawler implements \Countable, \IteratorAggregate } // Don't add duplicate nodes in the Crawler - if (in_array($node, $this->nodes, true)) { + if (\in_array($node, $this->nodes, true)) { return; } @@ -381,7 +381,7 @@ class Crawler implements \Countable, \IteratorAggregate */ public function slice($offset = 0, $length = null) { - return $this->createSubCrawler(array_slice($this->nodes, $offset, $length)); + return $this->createSubCrawler(\array_slice($this->nodes, $offset, $length)); } /** @@ -422,7 +422,7 @@ class Crawler implements \Countable, \IteratorAggregate */ public function last() { - return $this->eq(count($this->nodes) - 1); + return $this->eq(\count($this->nodes) - 1); } /** @@ -626,7 +626,7 @@ class Crawler implements \Countable, \IteratorAggregate * * Example: * - * $crawler->filter('h1 a')->extract(array('_text', 'href')); + * $crawler->filter('h1 a')->extract(array('_text', 'href')); * * @param array $attributes An array of attributes * @@ -635,7 +635,7 @@ class Crawler implements \Countable, \IteratorAggregate public function extract($attributes) { $attributes = (array) $attributes; - $count = count($attributes); + $count = \count($attributes); $data = array(); foreach ($this->nodes as $node) { @@ -765,7 +765,7 @@ class Crawler implements \Countable, \IteratorAggregate $node = $this->getNode(0); if (!$node instanceof \DOMElement) { - throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', get_class($node))); + throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', \get_class($node))); } return new Link($node, $this->baseHref, $method); @@ -783,7 +783,7 @@ class Crawler implements \Countable, \IteratorAggregate $links = array(); foreach ($this->nodes as $node) { if (!$node instanceof \DOMElement) { - throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', get_class($node))); + throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node))); } $links[] = new Link($node, $this->baseHref, 'get'); @@ -801,14 +801,14 @@ class Crawler implements \Countable, \IteratorAggregate */ public function image() { - if (!count($this)) { + if (!\count($this)) { throw new \InvalidArgumentException('The current node list is empty.'); } $node = $this->getNode(0); if (!$node instanceof \DOMElement) { - throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', get_class($node))); + throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', \get_class($node))); } return new Image($node, $this->baseHref); @@ -824,7 +824,7 @@ class Crawler implements \Countable, \IteratorAggregate $images = array(); foreach ($this as $node) { if (!$node instanceof \DOMElement) { - throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', get_class($node))); + throw new \InvalidArgumentException(sprintf('The current node list should contain only DOMElement instances, "%s" found.', \get_class($node))); } $images[] = new Image($node, $this->baseHref); @@ -852,7 +852,7 @@ class Crawler implements \Countable, \IteratorAggregate $node = $this->getNode(0); if (!$node instanceof \DOMElement) { - throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', get_class($node))); + throw new \InvalidArgumentException(sprintf('The selected node should be instance of DOMElement, got "%s".', \get_class($node))); } $form = new Form($node, $this->uri, $method, $this->baseHref); @@ -889,7 +889,7 @@ class Crawler implements \Countable, \IteratorAggregate * Escaped characters are: quotes (") and apostrophe ('). * * Examples: - * + * * echo Crawler::xpathLiteral('foo " bar'); * //prints 'foo " bar' * @@ -898,7 +898,7 @@ class Crawler implements \Countable, \IteratorAggregate * * echo Crawler::xpathLiteral('a\'b"c'); * //prints concat('a', "'", 'b"c') - * + * * * @param string $s String to be escaped * @@ -971,7 +971,7 @@ class Crawler implements \Countable, \IteratorAggregate // We cannot simply drop $nonMatchingExpression = 'a[name() = "b"]'; - $xpathLen = strlen($xpath); + $xpathLen = \strlen($xpath); $openedBrackets = 0; $startPosition = strspn($xpath, " \t\n\r\0\x0B"); @@ -1064,7 +1064,7 @@ class Crawler implements \Countable, \IteratorAggregate */ public function count() { - return count($this->nodes); + return \count($this->nodes); } /**