Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36675 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6471 invoked from network); 29 Mar 2008 12:00:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2008 12:00:11 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:43754] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/E7-53970-94F2EE74 for ; Sat, 29 Mar 2008 07:00:10 -0500 Received: from MBOERGER-ZRH (p50867B15.dip.t-dialin.net [80.134.123.21]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id EE3BA11DB43; Sat, 29 Mar 2008 13:00:04 +0100 (CET) Date: Sat, 29 Mar 2008 13:00:04 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1703206313.20080329130004@marcus-boerger.de> To: Elizabeth M Smith , "Gregory Beaver" CC: internals@lists.php.net In-Reply-To: References: <1206719555.6331.39.camel@localhost> <07.8D.25926.CD81DE74@pb1.pair.com> <1206723693.6331.48.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] phar API From: helly@php.net (Marcus Boerger) 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