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
31 * @param NodeInterface $selector
32 * @param string $combinator
33 * @param NodeInterface $subSelector
35 public function __construct(NodeInterface $selector, $combinator, NodeInterface $subSelector)
37 $this->selector = $selector;
38 $this->combinator = $combinator;
39 $this->subSelector = $subSelector;
43 * @return NodeInterface
45 public function getSelector()
47 return $this->selector;
53 public function getCombinator()
55 return $this->combinator;
59 * @return NodeInterface
61 public function getSubSelector()
63 return $this->subSelector;
69 public function getSpecificity()
71 return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
77 public function __toString()
79 $combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator;
81 return sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector);