You are here

protected function Minifier::getReal in Advanced CSS/JS Aggregation 7.2

Same name and namespace in other branches
  1. 8.4 advagg_js_minify/jshrink.inc \JShrink\Minifier::getReal()
  2. 8.2 advagg_js_minify/jshrink.inc \JShrink\Minifier::getReal()
  3. 8.3 advagg_js_minify/jshrink.inc \JShrink\Minifier::getReal()

This function gets the next "real" character. It is essentially a wrapper around the getChar function that skips comments. This has significant performance benefits as the skipping is done using native functions (ie, c code) rather than in script php.

Return value

string Next 'real' character to be processed.

Throws

\RuntimeException

3 calls to Minifier::getReal()
Minifier::initialize in advagg_js_compress/jshrink.inc
Initializes internal variables, normalizes new lines,
Minifier::loop in advagg_js_compress/jshrink.inc
The primary action occurs here. This function loops through the input string, outputting anything that's relevant and discarding anything that is not.
Minifier::saveRegex in advagg_js_compress/jshrink.inc
When a regular expression is detected this function crawls for the end of it and saves the whole regex.

File

advagg_js_compress/jshrink.inc, line 352

Class

Minifier
Minifier

Namespace

JShrink

Code

protected function getReal() {
  $startIndex = $this->index;
  $char = $this
    ->getChar();

  // Check to see if we're potentially in a comment
  if ($char !== '/') {
    return $char;
  }
  $this->c = $this
    ->getChar();
  if ($this->c === '/') {
    $this
      ->processOneLineComments($startIndex);
    return $this
      ->getReal();
  }
  elseif ($this->c === '*') {
    $this
      ->processMultiLineComments($startIndex);
    return $this
      ->getReal();
  }
  return $char;
}