You are here

protected function Minifier::getNext in Advanced CSS/JS Aggregation 8.4

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

Pushes the index ahead to the next instance of the supplied string. If it is found the first character of the string is returned and the index is set to it's position.

Parameters

string $string:

Return value

string|false Returns the first character of the string or false.

2 calls to Minifier::getNext()
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.

File

advagg_js_minify/jshrink.inc, line 457

Class

Minifier
Minifier

Namespace

JShrink

Code

protected function getNext($string) {

  // Find the next occurrence of "string" after the current position.
  $pos = strpos($this->input, $string, $this->index);

  // If it's not there return false.
  if ($pos === false) {
    return false;
  }

  // Adjust position of index to jump ahead to the asked for string
  $this->index = $pos;

  // Return the first character of that string.
  return substr($this->input, $this->index, 1);
}