Same name in other branches
  1. 5.0.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getChar()
  2. 7.x-2.x advagg_js_compress/jshrink.inc \JShrink\Minifier::getChar()
  3. 8.x-2.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getChar()
  4. 8.x-3.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getChar()
  5. 8.x-4.x advagg_js_minify/jshrink.inc \JShrink\Minifier::getChar()

Returns the next string for processing based off of the current index.

Return value

string

4 calls to Minifier::getChar()
Minifier::getReal in advagg_js_minify/jshrink.inc
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.
Minifier::processMultiLineComments in advagg_js_minify/jshrink.inc
Skips multiline comments where appropriate, and includes them where needed. Conditional comments and "license" style blocks are preserved.
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.
Minifier::saveString in advagg_js_minify/jshrink.inc
When a javascript string is detected this function crawls for the end of it and saves the whole string.

File

advagg_js_minify/jshrink.inc, line 334

Class

Minifier
Minifier

Namespace

JShrink

Code

protected function getChar() {
    // Check to see if we had anything in the look ahead buffer and use that.
    if (isset($this->c)) {
        $char = $this->c;
        unset($this->c);
    }
    else {
        // Otherwise we start pulling from the input.
        $char = $this->index < $this->len ? $this->input[$this->index] : false;
        // If the next character doesn't exist return false.
        if (isset($char) && $char === false) {
            return false;
        }
        // Otherwise increment the pointer and use this char.
        $this->index++;
    }
    // Normalize all whitespace except for the newline character into a
    // standard space.
    if ($char !== "\n" && $char < " ") {
        return ' ';
    }
    return $char;
}