You are here

protected function JSMin::min in Javascript Aggregator 5

Same name and namespace in other branches
  1. 6 jsmin.php \JSMin::min()

File

./jsmin.php, line 163

Class

JSMin
jsmin.php - PHP implementation of Douglas Crockford's JSMin.

Code

protected function min() {
  $this->a = "\n";
  $this
    ->action(3);
  while ($this->a !== null) {
    switch ($this->a) {
      case ' ':
        if ($this
          ->isAlphaNum($this->b)) {
          $this
            ->action(1);
        }
        else {
          $this
            ->action(2);
        }
        break;
      case "\n":
        switch ($this->b) {
          case '{':
          case '[':
          case '(':
          case '+':
          case '-':
            $this
              ->action(1);
            break;
          case ' ':
            $this
              ->action(3);
            break;
          default:
            if ($this
              ->isAlphaNum($this->b)) {
              $this
                ->action(1);
            }
            else {
              $this
                ->action(2);
            }
        }
        break;
      default:
        switch ($this->b) {
          case ' ':
            if ($this
              ->isAlphaNum($this->a)) {
              $this
                ->action(1);
              break;
            }
            $this
              ->action(3);
            break;
          case "\n":
            switch ($this->a) {
              case '}':
              case ']':
              case ')':
              case '+':
              case '-':
              case '"':
              case "'":
                $this
                  ->action(1);
                break;
              default:
                if ($this
                  ->isAlphaNum($this->a)) {
                  $this
                    ->action(1);
                }
                else {
                  $this
                    ->action(3);
                }
            }
            break;
          default:
            $this
              ->action(1);
            break;
        }
    }
  }
  return $this->output;
}