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


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

Reply via email to