Comments for "Stream_Iterate"

» Submit Your Comment
Comments are only accepted during the "Proposal" phase. This proposal is currently in the "Finished" phase.
» Comments
  • Christian Weiske  [2008-03-11 06:46 UTC]

    I fail to see why one would need this - could you give some examples?
  • Philippe Jausions  [2008-03-11 16:26 UTC]

    I used the stream wrapper with MDB2 and HTTP_Download to have less memory footprint during the download of big data, i.e. you don't need to put all the data in memory, format it then output it. The download starts sooner too.

    You could possibly also use it with copy() (PHP 5.3.0+), or fpassthru() and all the stream-based functions (stream filters for instance.)

    copy('foreach://value@data?callback=toString', '/path/to/file', $context);

    Bottom line, it allows you to view the transversable data as a stream.
  • Helgi Þormar Þorbjörnsson  [2008-03-11 17:08 UTC]

    This is a good idea since some people do like streams, even do templates with some stream thingo going on so I think it wouldn't hurt us to have this around.
  • Chuck Burgess  [2008-03-12 13:44 UTC]

    Method separation looks fine, though CS would bark about not using camelCasing ;)

    Does the trigger_error() usage imply that this class uses both PEAR_Error __and__ PEAR_Exception?

    All in all it looks like an interesting concept.
  • Philippe Jausions  [2008-03-12 13:56 UTC]

    @Chuck,

    The trigger_error() and non-camel case methods are required per the Stream API, so yes PHP_CodeSniffer barks, but nothing can be done about it.

    No PEAR_Error is returned, and the exception is only for the protocol registry part (which I think should be put in a separate PHP_Stream package for all the stream-base packages to used.)
  • Chuck Burgess  [2008-03-12 14:01 UTC]

    Ah, "inherited" restrictions... now I get it :)
  • Ken Guest  [2008-03-20 00:44 UTC]

    interesting concept
  • Michael Gauthier  [2008-05-01 20:11 UTC]

    I like the concept as long as lots of examples are provided with the final package. Much stream coolness is really cool but hard to figure out at first.

    Also, the package name is a bit weird. At first I thought it was an Iterator for streams when really it is a stream for Iterator objects or arrays. I'm not sure if there is a better name that would fit PEAR's naming scheme. Maybe Stream_IteratorStream.

    Is it possible to specify method callbacks like array('MyClass', 'myMethod') or array($object, 'myMethod')?
  • Michael Gauthier  [2008-05-01 20:13 UTC]

    Ah, I see it is possible to use method-type callbacks. I should have read the proposal description more carefully :)