Automattic\WooCommerce\Vendor\Symfony\Component\CssSelector\Parser\Shortcut
EmptyStringParser{}└─ ParserInterface
CSS selector class parser shortcut.
This shortcut ensure compatibility with previous version.
- The parser fails to parse an empty string.
- In the previous version, an empty string matches each tags.
This component is a port of the Python cssselect library, which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
No Hooks.
Usage
$EmptyStringParser = new EmptyStringParser(); // use class methods
Methods
- public parse(string $source)
EmptyStringParser{} EmptyStringParser{} code WC 10.5.0
class EmptyStringParser implements ParserInterface
{
/**
* {@inheritdoc}
*/
public function parse(string $source): array
{
// Matches an empty string
if ('' == $source) {
return [new SelectorNode(new ElementNode(null, '*'))];
}
return [];
}
}