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\CssSelector\Node; Chris@0: Chris@0: /** Chris@0: * Represents a ":" node. Chris@0: * Chris@0: * This component is a port of the Python cssselect library, Chris@0: * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. Chris@0: * Chris@0: * @author Jean-François Simon Chris@0: * Chris@0: * @internal Chris@0: */ Chris@0: class PseudoNode extends AbstractNode Chris@0: { Chris@0: private $selector; Chris@0: private $identifier; Chris@0: Chris@0: /** Chris@0: * @param NodeInterface $selector Chris@0: * @param string $identifier Chris@0: */ Chris@0: public function __construct(NodeInterface $selector, $identifier) Chris@0: { Chris@0: $this->selector = $selector; Chris@0: $this->identifier = strtolower($identifier); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @return NodeInterface Chris@0: */ Chris@0: public function getSelector() Chris@0: { Chris@0: return $this->selector; Chris@0: } Chris@0: Chris@0: /** Chris@0: * @return string Chris@0: */ Chris@0: public function getIdentifier() Chris@0: { Chris@0: return $this->identifier; Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function getSpecificity() Chris@0: { Chris@0: return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0)); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function __toString() Chris@0: { Chris@0: return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier); Chris@0: } Chris@0: }