raulfraile / distill

Smart compressed files extractor for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to rename an uncompressed directory

raulfraile opened this issue · comments

The library should allow to rename an uncompressed directory. Now, if compressedDir.tar.gz contains a directory called foo and is uncompressed in target, the final result will be:

$distill->extract('compressedDir.tar.gz', 'target');
// target/foo/[files]

There should be a third option to change the name, so the final result would be:

$distill->extract('compressedDir.tar.gz', 'target', true);
// target/[files]

/cc @javiereguiluz

I'm not an expert on "clean code", but they usually say that boolean arguments are bad for functions. What about creating a new method called extractAndMove() or extractToTarget() or something like that?

@javiereguiluz v0.7 includes a new method for this: extractWithoutRootDirectory. Could you check? It accepts the same parameters as extract.