Same name in other branches
  1. 5.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getReal()
  2. 7.x-2.x advagg_js_compress/jshrink.inc \JShrink\Minifier::getReal()
  3. 8.x-2.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getReal()
  4. 8.x-3.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getReal()
  5. 8.x-4.x 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_minify/jshrink.inc
Initializes internal variables, normalizes new lines,
Minifier::loop in advagg_js_minify/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_minify/jshrink.inc
When a regular expression is detected this function crawls for the end of it and saves the whole regex.

File

advagg_js_minify/jshrink.inc, line 372

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;
}