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 "<selector>.<name>" 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 ClassNode
extends AbstractNode
29 public function __construct(NodeInterface
$selector, string $name)
31 $this->selector
= $selector;
35 public function getSelector(): NodeInterface
37 return $this->selector
;
40 public function getName(): string
48 public function getSpecificity(): Specificity
50 return $this->selector
->getSpecificity()->plus(new Specificity(0, 1, 0));
53 public function __toString(): string
55 return sprintf('%s[%s.%s]', $this->getNodeName(), $this->selector
, $this->name
);