Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39670 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90550 invoked from network); 5 Aug 2008 19:37:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Aug 2008 19:37:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; 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:55388] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/E8-03679-BDBA8984 for ; Tue, 05 Aug 2008 15:36:59 -0400 Received: from MBOERGER-ZRH.corp.google.com (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 1005F11DB85; Tue, 5 Aug 2008 21:36:56 +0200 (CEST) Date: Tue, 5 Aug 2008 21:36:25 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <548800028.20080805213625@marcus-boerger.de> To: "Giorgio Sironi" CC: internals@lists.php.net In-Reply-To: <8637af910808051117q63d4faa4u54a6cff188f013a3@mail.gmail.com> References: <8637af910808051117q63d4faa4u54a6cff188f013a3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [php-internals] SplFileObject interface From: helly@php.net (Marcus Boerger) Hello Giorgio, you think to complex. Just use user streams and be done. marcus Tuesday, August 5, 2008, 8:17:06 PM, you wrote: > Hello everyone, I had a thought about Standard Php Library extension > and his classes and I'd like to expose an idea to see if it can have a > real utility. > Spl has interfaces like Traversable and Iterator that can be > implemented by programmers classes. It also has some class of basic > use like SplFileObject that provide access to the filesystem. > However, unit testing rules, which make it differs from integration > testing, says that testing a class shouldn't affect filesystems, > database and external resources. So what I propose is the creation of > an interface (if it does not already exist in some place) for > SplFileObject: some name like SplFileInterface or iSplFile, using > preferred naming conventions. > That could make a developer be able to do something like: > class Logger > { > public function __construct(SplFileInterface $file) > { > .... > making it easier to mock an object to test the class in isolation but > preserving type verification so that a NULL passed to constructor > produces a strict|fatal error. > Note that someone could also implements SplFileInterface with a > process similar to fopen url wrapper, making an external > resource|stream available as a file. I think it will be a clear way to > extend Php object orientation, now that Spl is doing that so much. > I'm looking for some comments and insults on this idea... > Greetings, > -- > Giorgio Sironi > Piccolo Principe & Ossigeno Scripter > http://www.sourceforge.net/projects/ossigeno Best regards, Marcus