Hello Elizabeth,

Friday, March 28, 2008, 7:50:28 PM, you wrote:

>>> The only things I see missing are an addFile and addDirectory shortcut
>>> methods for when I don't want to mess with all the metadata or creating
>>> iterators.
>> 
>> addDirectory() is called createDirectory() in my RFC, just ignore the
>> return value. What would you like addFile() to do? Adding an empty file?
>> 
>> cu, Lars

> Not add an empty directory - just add a directory and its contents much
> like the Phar::create would do - an assumption that you want everything
> in that directory inside with no iterators or magic required.

> addFile(filename) would just add a file - no thinking required, although
> if there was an addDirectory you wouldn't really need it.

> I'm just of the opinion that the less I have to write for common actions
> the better.

> $phar = new Phar('/path/to/phar');
> if($phar->isWriteable())
> {
>         $phar->addDirectory('/path/to/some/stuff');
> }

A method named AddDirdectory() sounds very confusing to me as to me it
would just add an empty directory. So the thing you proposed should be
named addFromDirectory() which would be in line with buildFromIterator().
And in the end you could just use that with a DirectoryIterator.

$phar = new Phar('/path/to/phar');
if($phar->isWriteable())
{
      $phar->buildFromDirectory(new DirectoyIterator('/path/to/some/stuff'));
}

Now I am wondering only why we didn't do buildFromIterator() as a static
factory method and have the current one as addFromIterator().

Maybe you guys also want the *FromDirectory() versions?


Best regards,
 Marcus


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to