cvs: php-src /ext/spl/examples directorygraphiterator.inc tree.php
| From: | Marcus Boerger | Date: | Mon, 01 Nov 2004 22:31:11 +0000 |
| Subject: | cvs: php-src /ext/spl/examples directorygraphiterator.inc tree.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-29097@lists.php.net to get a copy of this message | ||
helly Mon Nov 1 17:31:11 2004 EDT
Modified files:
/php-src/ext/spl/examples directorygraphiterator.inc tree.php
Log:
- Update examples
http://cvs.php.net/diff.php/php-src/ext/spl/examples/directorygraphiterator.inc?r1=1.5&r2=1.6&ty=u
Index: php-src/ext/spl/examples/directorygraphiterator.inc
diff -u /dev/null php-src/ext/spl/examples/directorygraphiterator.inc:1.6
--- /dev/null Mon Nov 1 17:31:11 2004
+++ php-src/ext/spl/examples/directorygraphiterator.inc Mon Nov 1 17:31:11 2004
@@ -0,0 +1,25 @@
+<?php
+
+/** @file directorygraphiterator.inc
+ * @ingroup Examples
+ * @brief class DirectoryGraphIterator
+ * @author Marcus Boerger
+ * @date 2003 - 2004
+ *
+ * SPL - Standard PHP Library
+ */
+
+/** @ingroup Examples
+ * @brief A tree iterator that only shows directories.
+ * @author Marcus Boerger
+ * @version 1.0
+ */
+class DirectoryGraphIterator extends DirectoryTreeIterator
+{
+ function __construct($path)
+ {
+ RecursiveIteratorIterator::__construct(new CachingRecursiveIterator(new ParentIterator(new
RecursiveDirectoryIterator($path)), CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD), 1);
+ }
+}
+
+?>
\ No newline at end of file
http://cvs.php.net/diff.php/php-src/ext/spl/examples/tree.php?r1=1.10&r2=1.11&ty=u
Index: php-src/ext/spl/examples/tree.php
diff -u php-src/ext/spl/examples/tree.php:1.10 php-src/ext/spl/examples/tree.php:1.11
--- php-src/ext/spl/examples/tree.php:1.10 Sun Oct 31 20:29:06 2004
+++ php-src/ext/spl/examples/tree.php Mon Nov 1 17:31:11 2004
@@ -29,9 +29,10 @@
}
if (!class_exists("DirectoryTreeIterator", false))
require_once("directorytreeiterator.inc");
+if (!class_exists("DirectoryGraphIterator", false))
require_once("directorygraphiterator.inc");
echo $argv[1]."\n";
-foreach(new DirectoryTreeIterator($argv[1]) as $file)
+foreach(new DirectoryGraphIterator($argv[1]) as $file)
{
echo $file . "\n";
}