Merge pull request #4036 from dokuwiki/issue4033
[dokuwiki.git] / _test / vendor / symfony / css-selector / Node / ElementNode.php
blobfbf8ea0f9909602fa0c0f0b52892108ee67278e5
1 <?php
3 /*
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;
14 /**
15 * Represents a "<namespace>|<element>" 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>
22 * @internal
24 class ElementNode extends AbstractNode
26 private $namespace;
27 private $element;
29 public function __construct(string $namespace = null, string $element = null)
31 $this->namespace = $namespace;
32 $this->element = $element;
35 public function getNamespace(): ?string
37 return $this->namespace;
40 public function getElement(): ?string
42 return $this->element;
45 /**
46 * {@inheritdoc}
48 public function getSpecificity(): Specificity
50 return new Specificity(0, 0, $this->element ? 1 : 0);
53 public function __toString(): string
55 $element = $this->element ?: '*';
57 return sprintf('%s[%s]', $this->getNodeName(), $this->namespace ? $this->namespace.'|'.$element : $element);