class FunctionNode
Represents a "<selector>:<name>(<arguments>)" node.
This component is a port of the Python cssselect library, which is copyright Ian Bicking, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
@internal
Hierarchy
- class \Symfony\Component\CssSelector\Node\AbstractNode implements \Symfony\Component\CssSelector\Node\NodeInterface
- class \Symfony\Component\CssSelector\Node\FunctionNode extends \Symfony\Component\CssSelector\Node\AbstractNode
Expanded class hierarchy of FunctionNode
See also
https://github.com/SimonSapin/cssselect.
3 files declare their use of FunctionNode
- FunctionExtension.php in vendor/
symfony/ css-selector/ XPath/ Extension/ FunctionExtension.php - HtmlExtension.php in vendor/
symfony/ css-selector/ XPath/ Extension/ HtmlExtension.php - Translator.php in vendor/
symfony/ css-selector/ XPath/ Translator.php
File
-
vendor/
symfony/ css-selector/ Node/ FunctionNode.php, line 26
Namespace
Symfony\Component\CssSelector\NodeView source
class FunctionNode extends AbstractNode {
private string $name;
/**
* @param Token[] $arguments
*/
public function __construct(NodeInterface $selector, string $name, array $arguments = []) {
$this->name = strtolower($name);
}
public function getSelector() : NodeInterface {
return $this->selector;
}
public function getName() : string {
return $this->name;
}
/**
* @return Token[]
*/
public function getArguments() : array {
return $this->arguments;
}
public function getSpecificity() : Specificity {
return $this->selector
->getSpecificity()
->plus(new Specificity(0, 1, 0));
}
public function __toString() : string {
$arguments = implode(', ', array_map(fn(Token $token) => "'" . $token->getValue() . "'", $this->arguments));
return \sprintf('%s[%s:%s(%s)]', $this->getNodeName(), $this->selector, $this->name, $arguments ? '[' . $arguments . ']' : '');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AbstractNode::$nodeName | private | property | ||
AbstractNode::getNodeName | public | function | Overrides NodeInterface::getNodeName | |
FunctionNode::$name | private | property | ||
FunctionNode::getArguments | public | function | ||
FunctionNode::getName | public | function | ||
FunctionNode::getSelector | public | function | ||
FunctionNode::getSpecificity | public | function | Overrides NodeInterface::getSpecificity | |
FunctionNode::__construct | public | function | ||
FunctionNode::__toString | public | function |