public function make($pathToFile, $type = 'zip')
    {
        $new = $this->createArchiveFile($pathToFile);

        $objectOrName = $type;
        if (is_string($type)) {
            $objectOrName = 'Chumper\Zipper\Repositories\\' . ucwords($type) . 'Repository';
        }

        if (!is_subclass_of($objectOrName, 'Chumper\Zipper\Repositories\RepositoryInterface')) {
            throw new \InvalidArgumentException("Class for '{$objectOrName}' must implement RepositoryInterface interface");
        }

        try {
            if (is_string($objectOrName)) {
                $this->repository = new $objectOrName($pathToFile, $new);
            } else {
                $this->repository = $type;
            }
        } catch(Exception $e) {
            throw $e;
        }

        $this->filePath = $pathToFile;

        return $this;
    }
public function make($pathToFile, $type = 'zip')
    {
        $new = $this->createArchiveFile($pathToFile);

        $objectOrName = $type;
        if (is_string($type)) {
            $objectOrName = 'Chumper\Zipper\Repositories\\' . ucwords($type) . 'Repository';
        }

        if (!is_subclass_of($objectOrName, 'Chumper\Zipper\Repositories\RepositoryInterface')) {
            throw new \InvalidArgumentException("Class for '{$objectOrName}' must implement RepositoryInterface interface");
        }

        try {
            if (is_string($objectOrName)) {
                $this->repository = new $objectOrName($pathToFile, $new);
            } else {
                $this->repository = $type;
            }
        } catch(Exception $e) {
            throw $e;
        }

        $this->filePath = $pathToFile;

        return $this;
    }
public function make ( $ pathToFile , $ type = 'zip' ) { $ new = $ this -> createArchiveFile ( $ pathToFile ) ; $ objectOrName = $ type ; if ( is_string ( $ type ) ) { $ objectOrName = 'Chumper\Zipper\Repositories\\' . ucwords ( $ type ) . 'Repository' ; } if ( ! is_subclass_of ( $ objectOrName , 'Chumper\Zipper\Repositories\RepositoryInterface' ) ) { throw new \ InvalidArgumentException ( "Class for '{$objectOrName}' must implement RepositoryInterface interface" ) ; } try { if ( is_string ( $ objectOrName ) ) { $ this -> repository = new $ objectOrName ( $ pathToFile , $ new ) ; } else { $ this -> repository = $ type ; } } catch ( Exception $ e ) { throw $ e ; } $ this -> filePath = $ pathToFile ; return $ this ; }
Create a new zip Archive if the file does not exists
opens a zip archive if the file exists

@param $pathToFile string The file to open
@param RepositoryInterface|string $type The type of the archive, defaults to zip, possible are zip, phar

@throws \RuntimeException
@throws \Exception
@throws \InvalidArgumentException

@return $this Zipper instance
Create a new zip Archive if the file does not exists opens a zip archive if the file exists