4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\CssSelector\Node;
15 * Represents a combined node.
17 * This component is a port of the Python cssselect library,
18 * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
20 * @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
24 class CombinedSelectorNode extends AbstractNode
42 * @param NodeInterface $selector
43 * @param string $combinator
44 * @param NodeInterface $subSelector
46 public function __construct(NodeInterface $selector, $combinator, NodeInterface $subSelector)
48 $this->selector = $selector;
49 $this->combinator = $combinator;
50 $this->subSelector = $subSelector;
54 * @return NodeInterface
56 public function getSelector()
58 return $this->selector;
64 public function getCombinator()
66 return $this->combinator;
70 * @return NodeInterface
72 public function getSubSelector()
74 return $this->subSelector;
80 public function getSpecificity()
82 return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
88 public function __toString()
90 $combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator;
92 return sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector);