This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DomCrawler/Link.php

35 lines
847 B
PHP
Raw Normal View History

2010-04-15 13:41:42 +01:00
<?php
/*
2010-04-24 00:22:16 +01:00
* This file is part of the Symfony package.
2010-04-15 13:41:42 +01:00
*
* (c) Fabien Potencier <fabien@symfony.com>
2010-04-15 13:41:42 +01:00
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\DomCrawler;
2010-04-15 13:41:42 +01:00
/**
* Link represents an HTML link (an HTML a, area or link tag).
2010-04-15 13:41:42 +01:00
*
* @author Fabien Potencier <fabien@symfony.com>
2010-04-15 13:41:42 +01:00
*/
class Link extends AbstractUriElement
2010-04-15 13:41:42 +01:00
{
protected function getRawUri()
{
return $this->node->getAttribute('href');
2010-04-15 13:41:42 +01:00
}
protected function setNode(\DOMElement $node)
2010-04-15 13:41:42 +01:00
{
if ('a' !== $node->nodeName && 'area' !== $node->nodeName && 'link' !== $node->nodeName) {
throw new \LogicException(sprintf('Unable to navigate from a "%s" tag.', $node->nodeName));
2011-06-14 14:16:43 +01:00
}
$this->node = $node;
2010-04-15 13:41:42 +01:00
}
}