Re: split out PEAR_PackageFileManager_File.php into a new package?

From: Date: Sat, 18 Oct 2003 19:05:30 +0000
Subject: Re: split out PEAR_PackageFileManager_File.php into a new package?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22798@lists.php.net to get a copy of this message
It's 377 lines of code with 2 public methods, and 6 private methods for help in setting up. The private methods could be made public, however, because they are useful for converting shell wildcards into preg-enabled wildcards. What I'm really asking is whether this code is useful to other people, and is worth making into a standardized package and the higher level of accountability and error control that goes into this change. Right now, I only need to make sure it works for the 2 apps I use it in, but I'm sure there are other reasons people might need to grab a directory listing, like a web-based file manager or something. The code is significant in that it is very difficult to do what it does properly, we're talking about 2 year's worth of refinement, responding to complaints from phpDocumentor users, and it's not something I ever wish to go through again :). I'd like to save other people the same trauma, if possible. Greg Lukas Smith wrote:
From: Greg Beaver [mailto:greg@chiaraquartet.net] Sent: Saturday, October 18, 2003 4:56 PM
The PEAR_PackageFileManager_File class in the PEAR_PackageFileManager package has some useful routines for retrieving full listings of files and directories, with the ability to selectively ignore based on standard shell wildcards, and also soon to selectively include based
on
wildcards. I replicate the code exactly in phpDocumentor, which leads me to believe there may be other applications that need it. I checked out File_Find, and although there is some similarity, I don't think
the
purpose of finding a file describes at all what the code intends to
do.
This code intends to simply grab a listing of every file in every directory minus ignored files. The listing is returned as a sorted
flat
array, allowing easy recursive processing without the need for a recursive structure or recursive code, a huge speedup in PHP, thanks
to
the magic of strnatcasecmp(). Basically, I'm wondering whether others would like to see this code split off into a package, perhaps Directory_List since that is its primary purpose, or File_List. If not, I'll just keep it where it is.
Well if you are beginning to duplicate significant code then you should wonder if a new package should be created or an existing should be extended. The emphasis lies on significant. Of course this is a relative term :-) Genereally the idea was not to go all out on dependencies in PEAR. But if we are talking about a chunk of 3-5 methods with each 10-20 LOC I would say it should get its own package. If its just 10 LOC total then its probably not worth it. If its in between then it gets complicated :-) Regards, Lukas


« previous php.pear.dev (#22798) next »