# learnpress/4.4.4/vendor/symfony/css-selector/Node/RelationNode.php

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.4.4. 69 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.4.4/code/vendor/symfony/css-selector/Node/RelationNode.php
- Raw: https://pluginprobe.com/plugins/learnpress/4.4.4/raw/vendor/symfony/css-selector/Node/RelationNode.php
- Modified: 2026-08-03T03:26:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/4.4.4/code/vendor/symfony/css-selector/Node/RelationNode.php#L10-L20`.

```php
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\CssSelector\Node;

/**
 * Represents a "<selector>:has(<subselector>)" node.
 *
 * This component is a port of the Python cssselect library,
 * which is copyright Ian Bicking, @see https://github.com/scrapy/cssselect.
 *
 * @author Franck Ranaivo-Harisoa <franckranaivo@gmail.com>
 *
 * @internal
 */
class RelationNode extends AbstractNode
{
    /**
     * @param list<array{0: string, 1: NodeInterface}> $arguments
     */
    public function __construct(
        private NodeInterface $selector,
        private array $arguments,
    ) {
    }

    public function getSelector(): NodeInterface
    {
        return $this->selector;
    }

    /**
     * @return list<array{0: string, 1: NodeInterface}>
     */
    public function getArguments(): array
    {
        return $this->arguments;
    }

    public function getSpecificity(): Specificity
    {
        $argumentsSpecificity = array_reduce(
            $this->arguments,
            static fn (Specificity $c, array $a) => 1 === $a[1]->getSpecificity()->compareTo($c) ? $a[1]->getSpecificity() : $c,
            new Specificity(0, 0, 0),
        );

        return $this->selector->getSpecificity()->plus($argumentsSpecificity);
    }

    public function __toString(): string
    {
        $parts = array_map(
            static fn (array $a): string => (' ' === $a[0] ? '' : $a[0].' ').$a[1],
            $this->arguments,
        );

        return \sprintf('%s[%s:has(%s)]', $this->getNodeName(), $this->selector, implode(', ', $parts));
    }
}

```
