MatthiasMullie\Minify\Minify::add PHP Method

add() public method

Add a file or straight-up code to be minified.
public add ( string | string[] $data )
$data string | string[]
    public function add($data)
    {
        // bogus "usage" of parameter $data: scrutinizer warns this variable is
        // not used (we're using func_get_args instead to support overloading),
        // but it still needs to be defined because it makes no sense to have
        // this function without argument :)
        $args = array($data) + func_get_args();
        // this method can be overloaded
        foreach ($args as $data) {
            if (is_array($data)) {
                call_user_func_array(array($this, 'add'), $data);
                continue;
            }
            // redefine var
            $data = (string) $data;
            // load data
            $value = $this->load($data);
            $key = $data != $value ? $data : count($this->data);
            // replace CR linefeeds etc.
            // @see https://github.com/matthiasmullie/minify/pull/139
            $value = str_replace(array("\r\n", "\r"), "\n", $value);
            // store data
            $this->data[$key] = $value;
        }
    }