Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\DomCrawler; Chris@0: Chris@0: /** Chris@0: * Image represents an HTML image (an HTML img tag). Chris@0: */ Chris@0: class Image extends AbstractUriElement Chris@0: { Chris@0: public function __construct(\DOMElement $node, $currentUri) Chris@0: { Chris@0: parent::__construct($node, $currentUri, 'GET'); Chris@0: } Chris@0: Chris@0: protected function getRawUri() Chris@0: { Chris@0: return $this->node->getAttribute('src'); Chris@0: } Chris@0: Chris@0: protected function setNode(\DOMElement $node) Chris@0: { Chris@0: if ('img' !== $node->nodeName) { Chris@0: throw new \LogicException(sprintf('Unable to visualize a "%s" tag.', $node->nodeName)); Chris@0: } Chris@0: Chris@0: $this->node = $node; Chris@0: } Chris@0: }