You are here

public function CssScanner::getQuotedString in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/CssParser.php \CssScanner::getQuotedString()
  2. 7.2 QueryPath/CssParser.php \CssScanner::getQuotedString()

File

QueryPath/CssParser.php, line 680

Class

CssScanner

Code

public function getQuotedString() {
  if ($this->token == CssToken::quote || $this->token == CssToken::squote || $this->token == CssToken::lparen) {
    $end = $this->token == CssToken::lparen ? CssToken::rparen : $this->token;
    $buf = '';
    $escape = FALSE;
    $this
      ->nextToken();
    while ($this->token !== FALSE && $this->token > -1) {
      if ($this->token == CssToken::bslash && !$escape) {
        $escape = TRUE;
      }
      elseif ($escape) {
        $buf .= $this->value;
        $escape = FALSE;
      }
      elseif ($this->token === $end) {
        $this
          ->nextToken();
        break;
      }
      else {
        $buf .= $this->value;
      }
      $this
        ->nextToken();
    }
    return $buf;
  }
}