You are here

class EmptyStringParser in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php \Symfony\Component\CssSelector\Parser\Shortcut\EmptyStringParser

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, @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>

Hierarchy

Expanded class hierarchy of EmptyStringParser

See also

https://github.com/SimonSapin/cssselect.

2 files declare their use of EmptyStringParser
CssSelector.php in vendor/symfony/css-selector/CssSelector.php
EmptyStringParserTest.php in vendor/symfony/css-selector/Tests/Parser/Shortcut/EmptyStringParserTest.php

File

vendor/symfony/css-selector/Parser/Shortcut/EmptyStringParser.php, line 30

Namespace

Symfony\Component\CssSelector\Parser\Shortcut
View source
class EmptyStringParser implements ParserInterface {

  /**
   * {@inheritdoc}
   */
  public function parse($source) {

    // Matches an empty string
    if ($source == '') {
      return array(
        new SelectorNode(new ElementNode(null, '*')),
      );
    }
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EmptyStringParser::parse public function Parses given selector source into an array of tokens. Overrides ParserInterface::parse