Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39668 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63365 invoked from network); 5 Aug 2008 18:17:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Aug 2008 18:17:25 -0000 Authentication-Results: pb1.pair.com header.from=piccoloprincipeazzurro@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=piccoloprincipeazzurro@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.172 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: piccoloprincipeazzurro@gmail.com X-Host-Fingerprint: 66.249.92.172 ug-out-1314.google.com Received: from [66.249.92.172] ([66.249.92.172:34096] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/73-03679-72998984 for ; Tue, 05 Aug 2008 14:17:23 -0400 Received: by ug-out-1314.google.com with SMTP id h3so106875ugf.29 for ; Tue, 05 Aug 2008 11:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=vpcc7h11zpx/QhkAtiwk5zTyAf07nEhZbsMekB/EVM8=; b=ewTY8z2q5PB3242gMO2Gy6wZMiw5ExY0hVdo85Ngwkq9S+c5XNlhA2XLCH56swLlkS e8+wtNzeTn0Jvw4m7XM7kNPZ85ycpkeArqp1Xus++pdbDjBVk5LyTChvPeSrau/kcIFS l85ayGRKrI1BUxABQ+sQcLf9yEsTBjVoDkL4Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=uOwv/HypxxNEKbwkTFYVo9DY3GVOMQeysNkM01vjGj3SwdatXP56sPff4mNNSCs6kb XKN+iwebmWQG1qeow99ku1abbgGNM9H4xKPIPl0iAkyRdSyUZWCAOMf+i2Qgm/r4zbR9 PindNLRdysNHlKYZKDHmjg5jR41rplhHvcGGE= Received: by 10.66.233.14 with SMTP id f14mr7275642ugh.12.1217960226986; Tue, 05 Aug 2008 11:17:06 -0700 (PDT) Received: by 10.67.89.10 with HTTP; Tue, 5 Aug 2008 11:17:06 -0700 (PDT) Message-ID: <8637af910808051117q63d4faa4u54a6cff188f013a3@mail.gmail.com> Date: Tue, 5 Aug 2008 20:17:06 +0200 To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [php-internals] SplFileObject interface From: piccoloprincipeazzurro@gmail.com ("Giorgio Sironi") 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