Hi Marcus, warning I smashed those two replies together into this

> You are right about Phar::canWrite() however there is also
> Phar::isWriteable(). All we have to do is overload it correctly so that it
> returns SplFileInfo::isWriteable() && Phar::canWrite().

Sounds good - one gripe fixed ;)

> 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().

That makes sense

> 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'));
> }

I kind of feel like I'm talking to a brick wall over this - you also
mentioned

> We liked the Phar::buildFromIterator() approach a lot :-)

That's nice for you, I don't appreciate it being my only option.  I'm
not a fan for normal use cases (might be useful if I want to pass a
filteriterator in there to manipulate what I'm shoving in) However that
is just not a normal use case for me. I'd venture to say most people
won't need it and will find it annoying to not have an easier option.

>
> 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?


The buildFrom* versions as static factories
and addFrom* versions work on the object - sounds like a winner to me

Thanks,
Elizabeth

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

Reply via email to