You are here

protected function Minifier::getChar in Advanced CSS/JS Aggregation 8.2

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

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

Return value

string

5 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…
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::processOneLineComments in advagg_js_minify/jshrink.inc
Removed one line comments, with the exception of some very specific types of conditional comments.
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 305

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

    // Otherwise we start pulling from the input.
  }
  else {
    $char = substr($this->input, $this->index, 1);

    // 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" && ord($char) < 32) {
    return ' ';
  }
  return $char;
}