Welcome Guest, Not a member yet? Register   Sign In
JSMin_PHP Library Port
#5

[eluser]tonydewan[/eluser]
I'm not sure why it was written that way, other than for the sake of brevity. You'd have to ask Ryan Grove (or perhaps Doug Crockford.) That is the way the class is written in the original JSMin PHP port. In porting it to CI, I only added the log_message function call and set a default value for $js in the constructor.

Your solution should work, assuming you match variable names (changing $js to $input):

Code:
public static function minify($input) {

    $this->input       = str_replace("\r\n", "\n", $input);
    $this->inputLength = strlen($this->input);
    
    $return = $this->min();

    // Housekeeping
    $this->input       = null;
    $this->inputLength = null;

    return $return;

  }

I still prefer the way it was originally written, if only because it's cleaner. Thanks for the comment!


Messages In This Thread
JSMin_PHP Library Port - by El Forum - 01-21-2009, 10:56 AM
JSMin_PHP Library Port - by El Forum - 01-21-2009, 10:59 AM
JSMin_PHP Library Port - by El Forum - 01-28-2009, 03:22 PM
JSMin_PHP Library Port - by El Forum - 01-28-2009, 04:05 PM
JSMin_PHP Library Port - by El Forum - 01-28-2009, 06:17 PM
JSMin_PHP Library Port - by El Forum - 01-28-2009, 07:32 PM
JSMin_PHP Library Port - by El Forum - 06-16-2010, 01:39 PM
JSMin_PHP Library Port - by El Forum - 06-17-2010, 07:41 AM
JSMin_PHP Library Port - by El Forum - 08-07-2011, 12:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB