Same name in other branches
  1. 5.0.x advagg_js_minify/jspacker.inc \ParseMaster::_replacement()
  2. 6.0.x advagg_js_minify/jspacker.inc \ParseMaster::_replacement()
  3. 7.x-2.x advagg_js_compress/jspacker.inc \ParseMaster::_replacement()
  4. 8.x-2.x advagg_js_minify/jspacker.inc \ParseMaster::_replacement()
  5. 8.x-3.x advagg_js_minify/jspacker.inc \ParseMaster::_replacement()
  6. 8.x-4.x advagg_js_minify/jspacker.inc \ParseMaster::_replacement()

File

advagg_js_compress/jspacker.inc, line 659

Class

ParseMaster

Code

private function _replacement($arguments) {
    if (empty($arguments)) {
        return '';
    }
    $i = 1;
    $j = 0;
    // loop through the patterns
    while (isset($this->_patterns[$j])) {
        $pattern = $this->_patterns[$j++];
        // do we have a result?
        if (isset($arguments[$i]) && $arguments[$i] != '') {
            $replacement = $pattern[self::REPLACEMENT];
            if (is_array($replacement) && isset($replacement['fn'])) {
                if (isset($replacement['data'])) {
                    $this->buffer = $replacement['data'];
                }
                return call_user_func(array(
                    &$this,
                    $replacement['fn'],
                ), $arguments, $i);
            }
            elseif (is_int($replacement)) {
                return $arguments[$replacement + $i];
            }
            $delete = $this->escapeChar == '' || strpos($arguments[$i], $this->escapeChar) === false ? '' : "\x01" . $arguments[$i] . "\x01";
            return $delete . $replacement;
            // skip over references to sub-expressions
        }
        else {
            $i += $pattern[self::LENGTH];
        }
    }
}