You are here

protected function JSqueeze::getNewName in Minify JS 7

File

lib/JSqueeze.php, line 952

Class

JSqueeze

Code

protected function getNewName($m) {
  $m = $m[0];
  $pre = '.' === $m[0] ? '.' : '';
  $post = '';
  if (',' === $m[0] || '{' === $m[0] || ' ' === $m[0]) {
    $pre = $m[0];
    if (':' === substr($m, -1)) {
      $post = ':';
      $m = (' ' !== $m[0] ? '.' : '') . substr($m, 1, -1);
    }
    elseif ('get ' === substr($m, 1, 4) || 'set ' === substr($m, 1, 4)) {
      $pre .= substr($m, 1, 4);
      $m = '.' . substr($m, 5);
    }
    else {
      $m = substr($m, 1);
    }
  }
  elseif (':' === substr($m, -1)) {
    $post = ':';
    $m = substr($m, 0, -1);
  }
  $post = (isset($this->reserved[$m]) ? 'true' === $m ? '!0' : ('false' === $m ? '!1' : $m) : (isset($this->local_tree[$m]) ? $this->local_tree[$m] : (isset($this->used_tree[$m]) ? $this->used_tree[$m] : $m))) . $post;
  return '' === $post ? '' : $pre . ('.' === $post[0] ? substr($post, 1) : $post);
}