Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Nathan Nobbe
On Mon, Feb 23, 2009 at 10:27 AM, Ryan Panning wrote: > Nathan Nobbe wrote: > >> if youre trying to do recursive iteration whereby you 'flatten' the tree >> structure, drop the RecursiveDirectoryIterator into a >> RecursiveIteratorIterator (its for iterating over RecursiveIterators), >> then >> y

Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Philip Graham
On February 23, 2009 12:32:26 Ryan Panning wrote: > Hi, although I don't think this will work in my situation, there is an > interesting piece of code that you have. > > array_push($this->_dirStack, $this->_curDirIter); > > Are you able to "inject" the iterator with more items? I would like to > do

Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning
Philip Graham wrote: Here's a RecursiveDirectoryIterator class I've written and find quite useful: mailto:phi...@lightbox.org";>Philip Graham */ class Util_RecursiveFileIterator implements Iterator { CONST SHOW_DOT_FILES = true; private $_basePath; private $_curDirIter; private

Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning
Nathan Nobbe wrote: if youre trying to do recursive iteration whereby you 'flatten' the tree structure, drop the RecursiveDirectoryIterator into a RecursiveIteratorIterator (its for iterating over RecursiveIterators), then you dont have to bother w/ calling hasChildren() at all. you probly also

Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Nathan Nobbe
On Mon, Feb 23, 2009 at 9:31 AM, Ryan Panning wrote: > I have discovered that when I foreach over a RecursiveDirectoryIterator > (see example below) the $item actually turns into a SplFileInfo object. I > would expect it to be a RecursiveDirectoryIterator. How do I do a > hasChildren() on SplFile

Re: [PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Philip Graham
Here's a RecursiveDirectoryIterator class I've written and find quite useful: mailto:phi...@lightbox.org";>Philip Graham */ class Util_RecursiveFileIterator implements Iterator { CONST SHOW_DOT_FILES = true; private $_basePath; private $_curDirIter; private $_dirStack; privat

[PHP] RecursiveDirectoryIterator and foreach

2009-02-23 Thread Ryan Panning
I have discovered that when I foreach over a RecursiveDirectoryIterator (see example below) the $item actually turns into a SplFileInfo object. I would expect it to be a RecursiveDirectoryIterator. How do I do a hasChildren() on SplFileInfo? However, if I change it to a non-recursive, Director