| 1: | <?php |
| 2: | class MinifierException extends \RuntimeException {} ; |
| 3: | abstract class Minifier |
| 4: | { |
| 5: | const TOKEN_NONE = 0 ; |
| 6: | const TOKEN_SPACE = 1 ; |
| 7: | const TOKEN_NEWLINE = 2 ; |
| 8: | const TOKEN_STRING = 3 ; |
| 9: | const TOKEN_ELEMENT = 4 ; |
| 10: | const TOKEN_IDENTIFIER = 5 ; |
| 11: | protected $SingleLineComments = [] ; |
| 12: | protected $MultiLineComments = [] ; |
| 13: | protected $QuotedStrings = [] ; |
| 14: | protected $Continuation = false ; |
| 15: | protected $Spaces = [ " " => " ", "\t" => "\t", "\v" => "\v", "\r" => "\r", "\xA0" => "\xA0" ] ; |
| 16: | protected $IdentifierRegex = false ; |
| 17: | protected $Tokens = [] ; |
| 18: | protected $Content ; |
| 19: | protected $ContentLength ; |
| 20: | protected $CurrentLine ; |
| 21: | protected $LastToken ; |
| 22: | protected $LastTokenType ; |
| 23: | protected function Finalize ( ) |
| 24: | {} |
| 25: | protected function SetComments ( $single_comments, $multi_comments ) |
| 26: | {} |
| 27: | protected function SetQuotedStrings ( $strings ) |
| 28: | {} |
| 29: | protected function SetContinuation ( $string ) |
| 30: | {} |
| 31: | protected function SetSpaces ( $spaces ) |
| 32: | {} |
| 33: | protected function SetIdentifierRegex ( $re ) |
| 34: | {} |
| 35: | protected function SetTokens ( $tokens ) |
| 36: | {} |
| 37: | protected function Reset ( $data = '' ) |
| 38: | {} |
| 39: | abstract protected function MinifyData ( ) ; |
| 40: | public function Minify ( $contents ) |
| 41: | {} |
| 42: | public function MinifyFrom ( $input ) |
| 43: | {} |
| 44: | public function MinifyTo ( $output, $contents ) |
| 45: | {} |
| 46: | public function MinifyFileTo ( $output, $input ) |
| 47: | {} |
| 48: | protected function GetNextToken ( &$offset, &$token, &$token_type ) |
| 49: | {} |
| 50: | protected function ProcessContinuation ( $contents, $length, &$offset, $continuation ) |
| 51: | {} |
| 52: | protected function ProcessSingleLineComments ( $contents, $length, &$offset ) |
| 53: | {} |
| 54: | protected function ProcessSpaces ( $contents, $length, &$offset, &$token, &$token_type ) |
| 55: | {} |
| 56: | protected function EatSpaces ( $contents, $length, &$offset ) |
| 57: | {} |
| 58: | protected function ProcessNewlines ( $contents, $length, &$offset, &$token, &$token_type ) |
| 59: | {} |
| 60: | protected function ProcessMultiLineComments ( $contents, $length, &$offset ) |
| 61: | {} |
| 62: | protected function ProcessString ( $contents, $length, &$offset, &$token, &$token_type ) |
| 63: | {} |
| 64: | protected function ProcessToken ( $contents, $length, &$offset, &$token, &$token_type ) |
| 65: | {} |
| 66: | } |
| 67: |