summaryrefslogtreecommitdiff
path: root/ext/spl/examples
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/examples')
-rwxr-xr-xext/spl/examples/autoload.inc7
-rw-r--r--ext/spl/examples/cachingiterator.inc81
-rw-r--r--ext/spl/examples/cachingrecursiveiterator.inc47
-rwxr-xr-xext/spl/examples/dba_array.php98
-rwxr-xr-xext/spl/examples/dba_dump.php40
-rwxr-xr-xext/spl/examples/dba_reader.inc83
-rwxr-xr-xext/spl/examples/directoryfilterdots.inc26
-rw-r--r--ext/spl/examples/directorygraphiterator.inc11
-rwxr-xr-xext/spl/examples/directorytree.inc10
-rwxr-xr-xext/spl/examples/directorytree.php33
-rw-r--r--ext/spl/examples/directorytreeiterator.inc26
-rwxr-xr-xext/spl/examples/filteriterator.inc97
-rwxr-xr-xext/spl/examples/findfile.php41
-rwxr-xr-xext/spl/examples/ini_groups.php78
-rwxr-xr-xext/spl/examples/key_filter.inc106
-rwxr-xr-xext/spl/examples/limititerator.inc72
-rw-r--r--ext/spl/examples/parentiterator.inc25
-rw-r--r--ext/spl/examples/recursiveiterator.inc9
-rwxr-xr-xext/spl/examples/recursiveiteratoriterator.inc101
-rwxr-xr-xext/spl/examples/searchiterator.inc21
-rwxr-xr-xext/spl/examples/seekableiterator.inc29
-rwxr-xr-xext/spl/examples/tree.php34
22 files changed, 0 insertions, 1075 deletions
diff --git a/ext/spl/examples/autoload.inc b/ext/spl/examples/autoload.inc
deleted file mode 100755
index 34072f8e4a..0000000000
--- a/ext/spl/examples/autoload.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-
-function __autoload($classname) {
- require_once(dirname($_SERVER['PATH_TRANSLATED']).'/'.strtolower($classname).'.inc');
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/cachingiterator.inc b/ext/spl/examples/cachingiterator.inc
deleted file mode 100644
index d828b88e7b..0000000000
--- a/ext/spl/examples/cachingiterator.inc
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-define('CIT_CALL_TOSTRING', 1);
-define('CIT_CATCH_GET_CHILD', 2);
-
-class CachingIterator
-{
- protected $it;
- protected $current;
- protected $key;
- protected $more;
- protected $strValue;
- protected $getStrVal;
-
- function __construct(Iterator $it, $flags = CIT_CALL_TOSTRING)
- {
- $this->it = $it;
- $this->flags = $flags & (CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD);
- }
-
- function rewind()
- {
- $this->it->rewind();
- $this->next();
- }
-
- function next()
- {
- if ($this->more = $this->it->hasMore()) {
- $this->current = $this->it->current();
- $this->key = $this->it->key();
- if ($this->flags & CIT_CALL_TOSTRING) {
- if (is_object($this->current)) {
- $this->strValue = $this->current->__toString();
- } else {
- $this->strValue = (string)$this->current;
- }
- }
- } else {
- $this->current = NULL;
- $this->key = NULL;
- $this->strValue = NULL;
- }
- $this->it->next();
- }
-
- function hasMore()
- {
- return $this->more;
- }
-
- function hasNext()
- {
- return $this->it->hasMore();
- }
-
- function current()
- {
- return $this->current;
- }
-
- function key()
- {
- return $this->key;
- }
-
- function __call($func, $params)
- {
- return call_user_func_array(array($this->it, $func), $params);
- }
-
- function __toString()
- {
- if (!$this->flags & CIT_CALL_TOSTRING) {
- throw new exception('CachingIterator does not fetch string value (see CachingIterator::__construct)');
- }
- return $this->strValue;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/cachingrecursiveiterator.inc b/ext/spl/examples/cachingrecursiveiterator.inc
deleted file mode 100644
index dfeeea54e7..0000000000
--- a/ext/spl/examples/cachingrecursiveiterator.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-class CachingRecursiveIterator extends CachingIterator implements RecursiveIterator
-{
- protected $hasChildren;
- protected $getChildren;
- protected $catch_get_child;
-
- function __construct(RecursiveIterator $it, $flags = CIT_CALL_TOSTRING)
- {
- parent::__construct($it, $flags);
- }
-
- function next()
- {
- if ($this->hasChildren = $this->it->hasChildren()) {
- try {
- //$this->getChildren = new CachingRecursiveIterator($this->it->getChildren(), $this->flags);
- // workaround memleaks...
- $child = $this->it->getChildren();
- $this->getChildren = new CachingRecursiveIterator($child, $this->flags);
- }
- catch(Exception $e) {
- if (!$this->flags & CIT_CATCH_GET_CHILD) {
- throw $e;
- }
- $this->hasChildren = false;
- $this->getChildren = NULL;
- }
- } else {
- $this->getChildren = NULL;
- }
- parent::next();
- }
-
- function hasChildren()
- {
- return $this->hasChildren;
- }
-
- function getChildren()
- {
- return $this->getChildren;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dba_array.php b/ext/spl/examples/dba_array.php
deleted file mode 100755
index 931e3cfb92..0000000000
--- a/ext/spl/examples/dba_array.php
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-
-/** dba array utility
- *
- * Usage php dba_array.php <file> <handler> <key> [<value>]
- *
- * If <value> is specified then <key> is set to <value> in <file>.
- * Else the value of <key> is printed only.
- *
- * Note: configure with --enable-dba
- *
- * (c) Marcus Boerger, 2003
- */
-
-if ($argc < 4) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <file> <handler> <key> [<value>]
-
-If <value> is specified then <key> is set to <value> in <file>.
-Else the value of <key> is printed only.
-
-
-EOF;
- exit(1);
-}
-
-class DbaArray implements ArrayAccess {
- private $db;
-
- function __construct($file, $handler)
- {
- $this->db = dba_popen($file, "c", $handler);
- if (!$this->db) {
- throw new exception("Databse could not be opened");
- }
- }
-
- function __destruct()
- {
- dba_close($this->db);
- }
-
- function get($name)
- {
- $data = dba_fetch($name, $this->db);
- if($data) {
- if (ini_get('magic_quotes_runtime')) {
- $data = stripslashes($data);
- }
- //return unserialize($data);
- return $data;
- }
- else
- {
- return NULL;
- }
- }
-
- function set($name, $value)
- {
- //dba_replace($name, serialize($value), $this->db);
- dba_replace($name, $value, $this->db);
- return $value;
- }
-
- function exists($name)
- {
- return dba_exists($name, $this->db);
- }
-
- function del($name)
- {
- return dba_delete($name, $this->db);
- }
-}
-
-try {
- if ($argc > 2) {
- $dba = new DbaArray($argv[1], $argv[2]);
- if ($dba && $argc > 3) {
- if ($argc > 4) {
- $dba[$argv[3]] = $argv[4];
- }
- var_dump(array('Index' => $argv[3], 'Value' => $dba[$argv[3]]));
- }
- unset($dba);
- }
- else
- {
- echo "Not enough parameters\n";
- exit(1);
- }
-}
-catch (exception $err) {
- var_dump($err);
- exit(1);
-}
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dba_dump.php b/ext/spl/examples/dba_dump.php
deleted file mode 100755
index b608c9fe63..0000000000
--- a/ext/spl/examples/dba_dump.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-/** dba dump utility
- *
- * Usage: php dba_dump.php <file> <handler> [<regex>]
- *
- * Show all groups in the ini file specified by <file>.
- * The regular expression <regex> is used to filter the by setting name.
- *
- * Note: configure with --enable-dba
- *
- * (c) Marcus Boerger, 2003
- */
-
-if ($argc < 3) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <file> <handler> [<regex>]
-
-Show all groups in the ini file specified by <file>.
-The regular expression <regex> is used to filter the by setting name.
-
-
-EOF;
- exit(1);
-}
-
-require_once("dba_reader.inc");
-require_once("key_filter.inc");
-
-$db = new DbaReader($argv[1], $argv[2]);
-
-if ($argc>3) {
- $db = new keyFilter($db, $argv[3]);
-}
-
-foreach($db as $key => $val) {
- echo "'$key' => '$val'\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/dba_reader.inc b/ext/spl/examples/dba_reader.inc
deleted file mode 100755
index d21db45613..0000000000
--- a/ext/spl/examples/dba_reader.inc
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-/**
- * @brief This implements a Dba Iterator.
- * @author Marcus Boerger
- * @version 1.0
- */
-class DbaReader implements Iterator
-{
-
- private $db = NULL;
- private $key = false;
- private $val = false;
-
- /**
- * Open database $file with $handler in read only mode.
- *
- * @param file Database file to open.
- * @param handler Handler to use for database access.
- */
- function __construct($file, $handler) {
- $this->db = dba_open($file, 'r', $handler);
- }
-
- /**
- * Close database.
- */
- function __destruct() {
- if ($this->db) {
- dba_close($this->db);
- }
- }
-
- /**
- * Rewind to first element.
- */
- function rewind() {
- if ($this->db) {
- $this->key = dba_firstkey($this->db);
- }
- }
-
- /**
- * @return Current data.
- */
- function current() {
- return $this->val;
- }
-
- /**
- * Move to next element.
- *
- * @return void
- */
- function next() {
- if ($this->db) {
- $this->key = dba_nextkey($this->db);
- if ($this->key !== false) {
- $this->val = dba_fetch($this->key, $this->db);
- }
- }
- }
-
- /**
- * @return Whether more elements are available.
- */
- function hasMore() {
- if ($this->db && $this->key !== false) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @return Current key.
- */
- function key() {
- return $this->key;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directoryfilterdots.inc b/ext/spl/examples/directoryfilterdots.inc
deleted file mode 100755
index 3ca0e6a2f8..0000000000
--- a/ext/spl/examples/directoryfilterdots.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-class DirectoryFilterDots extends FilterIterator implements RecursiveIterator
-{
- function __construct($path) {
- parent::__construct(new DirectoryIterator($path));
- }
-
- function accept() {
- return !$this->it->isDot();
- }
-
- function hasChildren() {
- return $this->it->hasChildren();
- }
-
- function getChildren() {
- return new DirectoryFilterDots($this->it->getPathname());
- }
-
- function key() {
- return $this->it->getPathname();
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorygraphiterator.inc b/ext/spl/examples/directorygraphiterator.inc
deleted file mode 100644
index a8382e2baa..0000000000
--- a/ext/spl/examples/directorygraphiterator.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-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
diff --git a/ext/spl/examples/directorytree.inc b/ext/spl/examples/directorytree.inc
deleted file mode 100755
index 218ca513d9..0000000000
--- a/ext/spl/examples/directorytree.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-class DirectoryTree extends RecursiveIteratorIterator
-{
- function __construct($path) {
- parent::__construct(new DirectoryFilterDots($path));
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorytree.php b/ext/spl/examples/directorytree.php
deleted file mode 100755
index de6cdc76b2..0000000000
--- a/ext/spl/examples/directorytree.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-/** tree view example
- *
- * Usage: php directorytree.php <path> [<start> [<count>]]
- *
- * Simply specify the path to tree with parameter <path>.
- *
- * (c) Marcus Boerger, 2003
- */
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <path>
-
-Displays a graphical directory tree for the given <path>.
-
-<path> The directory for which to generate the directory tree graph.
-
-
-EOF;
- exit(1);
-}
-
-$length = $argc > 3 ? $argv[3] : -1;
-
-echo $argv[1]."\n";
-foreach(new LimitIterator(new DirectoryTreeIterator($argv[1]), @$argv[2], $length) as $file) {
-//foreach(new DirectoryTreeIterator($argv[1]) as $file) {
- echo $file . "\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/directorytreeiterator.inc b/ext/spl/examples/directorytreeiterator.inc
deleted file mode 100644
index 13253d9a52..0000000000
--- a/ext/spl/examples/directorytreeiterator.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-class DirectoryTreeIterator extends RecursiveIteratorIterator
-{
- function __construct($path)
- {
- parent::__construct(new CachingRecursiveIterator(new RecursiveDirectoryIterator($path), CIT_CALL_TOSTRING|CIT_CATCH_GET_CHILD), 1);
- }
-
- function current()
- {
- $tree = '';
- for ($l=0; $l < $this->getDepth(); $l++) {
- $tree .= $this->getSubIterator($l)->hasNext() ? '| ' : ' ';
- }
- return $tree . ($this->getSubIterator($l)->hasNext() ? '|-' : '\-')
- . $this->getSubIterator($l)->__toString();
- }
-
- function __call($func, $params)
- {
- return call_user_func_array(array($this->getSubIterator(), $func), $params);
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/filteriterator.inc b/ext/spl/examples/filteriterator.inc
deleted file mode 100755
index ac8236aa36..0000000000
--- a/ext/spl/examples/filteriterator.inc
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * @brief Regular expression filter for string iterators
- * @author Marcus Boerger
- * @version 1.0
- *
- * Instances of this class act as a filter around iterators. In other words
- * you can put an iterator into the constructor and the instance will only
- * return selected (accepted) elements.
- */
-abstract class FilterIterator implements Iterator
-{
- protected $it;
-
- /**
- * Constructs a filter around an iterator whose elemnts are strings.
- * If the given iterator is of type spl_sequence then its rewind()
- * method is called.
- *
- * @param it Object that implements at least spl_forward
- */
- function __construct(Iterator $it) {
- $this->it = $it;
- }
-
- /**
- * Rewind the inner iterator.
- */
- function rewind() {
- $this->it->rewind();
- $this->fetch();
- }
-
- /**
- * Accept function to decide whether an element of the inner iterator
- * should be accessible through the Filteriterator.
- *
- * @return whether or not to expose the current element of the inner
- * iterator.
- */
- abstract function accept();
-
- /**
- * Fetch next element and store it.
- *
- * @return void
- */
- protected function fetch() {
- while ($this->it->hasMore()) {
- if ($this->accept()) {
- return;
- }
- $this->it->next();
- };
- }
-
- /**
- * Move to next element
- *
- * @return void
- */
- function next() {
- $this->it->next();
- $this->fetch();
- }
-
- /**
- * @return Whether more elements are available
- */
- function hasMore() {
- return $this->it->hasMore();
- }
-
- /**
- * @return The current key
- */
- function key() {
- return $this->it->key();
- }
-
- /**
- * @return The current value
- */
- function current() {
- return $this->it->current();
- }
-
- /**
- * hidden __clone
- */
- protected function __clone() {
- // disallow clone
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/findfile.php b/ext/spl/examples/findfile.php
deleted file mode 100755
index 68c0e0dd65..0000000000
--- a/ext/spl/examples/findfile.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-/** Find a specific file by name.
- *
- * Usage: php findfile.php <path> <name>
- *
- * <path> Path to search in.
- * <name> Filename to look for.
- *
- * (c) Marcus Boerger, 2003
- */
-
-if ($argc < 3) {
- echo <<<EOF
-Usage: php findfile.php <file> <name>
-
-Find a specific file by name.
-
-<path> Path to search in.
-<name> Filename to look for.
-
-
-EOF;
- exit(1);
-}
-
-class FindFile extends FilterIterator
-{
- protected $file;
-
- function __construct($path, $file) {
- $this->file = $file;
- parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
- }
- function accept() {
- return !strcmp($this->current(), $this->file);
- }
-}
-
-foreach(new FindFile($argv[1], $argv[2]) as $pathname => $file) echo $file->getPathname()."\n";
-?> \ No newline at end of file
diff --git a/ext/spl/examples/ini_groups.php b/ext/spl/examples/ini_groups.php
deleted file mode 100755
index 7ebdaed7f9..0000000000
--- a/ext/spl/examples/ini_groups.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/** List groups within an ini file
- *
- * Usage: php dba_dump.php <file> [<regex>]
- *
- * Show all groups in the ini file specified by <file>.
- * The regular expression <regex> is used to filter the result.
- *
- * Note: configure with --enable-dba
- *
- * (c) Marcus Boerger, 2003
- */
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php dba_dump.php <file> [<regex>]
-
-Show all groups in the ini file specified by <file>.
-The regular expression <regex> is used to filter the result.
-
-
-EOF;
- exit(1);
-}
-
-require_once("dba_reader.inc");
-require_once("key_filter.inc");
-
-/**
- * @brief Class to iterate all groups within an ini file.
- * @author Marcus Boerger
- * @version 1.0
- *
- * Using this class you can iterator over all groups of a ini file.
- *
- * This class uses a 'is-a' relation to key_filter in contrast to a 'has-a'
- * relation. Doing so both current() and key() methods must be overwritten.
- * If it would use a 'has-a' relation there would be much more to type...
- * but for puritists that would allow correctness in so far as then no
- * key() would be needed.
- */
-class ini_groups extends key_filter
-{
- /**
- * Construct an ini file group iterator from a filename.
- *
- * @param file Ini file to open.
- */
- function __construct($file) {
- parent::__construct(new dba_reader($file, 'inifile'), '^\[.*\]$');
- }
-
- /**
- * @return The current group.
- */
- function current() {
- return substr(parent::key(),1,-1);
- }
-
- /**
- * @return The current group.
- */
- function key() {
- return substr(parent::key(),1,-1);
- }
-}
-
-$it = new ini_groups($argv[1]);
-if ($argc>2) {
- $it = new key_filter($it, $argv[2]);
-}
-
-foreach($it as $group) {
- echo "$group\n";
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/key_filter.inc b/ext/spl/examples/key_filter.inc
deleted file mode 100755
index 6dfd19c85b..0000000000
--- a/ext/spl/examples/key_filter.inc
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-/**
- * @brief Regular expression filter for string iterators
- * @author Marcus Boerger
- * @version 1.0
- *
- * Instances of this class act as a filter around iterators whose elements
- * are strings. In other words you can put an iterator into the constructor
- * and the instance will only return elements which match the given regular
- * expression.
- */
-class KeyFilter implements Iterator
-{
- protected $it;
- protected $regex;
- protected $key;
- protected $curr;
-
- /**
- * Constructs a filter around an iterator whose elemnts are strings.
- * If the given iterator is of type spl_sequence then its rewind()
- * method is called.
- *
- * @param it Object that implements at least spl_forward
- * @patam regex Regular expression used as a filter.
- */
- function __construct(Iterator $it, $regex) {
- $this->it = $it;
- $this->regex = $regex;
- $this->fetch();
- }
-
- /**
- * Rewind input iterator
- */
- function rewind() {
- $this->it->rewind();
- }
-
- /**
- * Destruct the iterator.
- */
- function __destruct() {
- unset($this->it);
- }
-
- /**
- * Fetch next element and store it.
- *
- * @return void
- */
- protected function fetch() {
- $this->key = false;
- $this->curr = false;
- while ($this->it->hasMore()) {
- $key = $this->it->key();
- if (ereg($this->regex, $key)) {
- $this->key = $key;
- $this->curr = $this->it->current();
- return;
- }
- $this->it->next();
- };
- }
-
- /**
- * Move to next element
- *
- * @return void
- */
- function next() {
- $this->it->next();
- $this->fetch();
- }
-
- /**
- * @return Whether more elements are available
- */
- function hasMore() {
- return $this->key !== false;
- }
-
- /**
- * @return The current key
- */
- function key() {
- return $this->key;
- }
-
- /**
- * @return The current value
- */
- function current() {
- return $this->curr;
- }
-
- /**
- * hidden __clone
- */
- protected function __clone() {
- // disallow clone
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/limititerator.inc b/ext/spl/examples/limititerator.inc
deleted file mode 100755
index e471f5d0e4..0000000000
--- a/ext/spl/examples/limititerator.inc
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-
-class LimitIterator implements Iterator
-{
- protected $it;
- protected $offset;
- protected $count;
- private $pos;
-
- // count === NULL means all
- function __construct(Iterator $it, $offset = 0, $count = -1)
- {
- if ($offset < 0) {
- throw new exception('Parameter offset must be > 0');
- }
- if ($count < 0 && $count != -1) {
- throw new exception('Parameter count must either be -1 or a value greater than or equal to 0');
- }
- $this->it = $it;
- $this->offset = $offset;
- $this->count = $count;
- $this->pos = 0;
- }
-
- function seek($position) {
- if ($position < $this->offset) {
- throw new exception('Cannot seek to '.$position.' which is below offset '.$this->offset);
- }
- if ($position > $this->offset + $this->count && $this->count != -1) {
- throw new exception('Cannot seek to '.$position.' which is behind offset '.$this->offset.' plus count '.$this->count);
- }
- if ($this->it instanceof SeekableIterator) {
- $this->it->seek($position);
- $this->pos = $position;
- } else {
- while($this->pos < $position && $this->it->hasMore()) {
- $this->next();
- }
- }
- }
-
- function rewind()
- {
- $this->it->rewind();
- $this->pos = 0;
- $this->seek($this->offset);
- }
-
- function hasMore() {
- return ($this->count == -1 || $this->pos < $this->offset + $this->count)
- && $this->it->hasMore();
- }
-
- function key() {
- return $this->it->key();
- }
-
- function current() {
- return $this->it->current();
- }
-
- function next() {
- $this->it->next();
- $this->pos++;
- }
-
- function getPosition() {
- return $this->pos;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/parentiterator.inc b/ext/spl/examples/parentiterator.inc
deleted file mode 100644
index 4b758132ac..0000000000
--- a/ext/spl/examples/parentiterator.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-class ParentIterator extends FilterIterator implements RecursiveIterator
-{
- function __construct(RecursiveIterator $it)
- {
- parent::__construct($it);
- }
- function accept()
- {
- return $this->it->hasChildren();
- }
-
- function hasChildren()
- {
- return $this->it->hasChildren();
- }
-
- function getChildren()
- {
- return new ParentIterator($this->it->getChildren());
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/recursiveiterator.inc b/ext/spl/examples/recursiveiterator.inc
deleted file mode 100644
index 63523ffad9..0000000000
--- a/ext/spl/examples/recursiveiterator.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-interface RecursiveIterator implements Iterator
-{
- function hasChildren();
- function getChildren();
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/recursiveiteratoriterator.inc b/ext/spl/examples/recursiveiteratoriterator.inc
deleted file mode 100755
index b48efb2b3b..0000000000
--- a/ext/spl/examples/recursiveiteratoriterator.inc
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-
-/**
- * @brief Iterates through recursive iterators
- * @author Marcus Boerger
- * @version 1.0
- *
- */
-class RecursiveIteratorIterator implements Iterator
-{
- protected $ait = array();
- protected $count = 0;
-
- function __construct(RecursiveIterator $it)
- {
- $this->ait[0] = $it;
- }
-
-
- function rewind()
- {
- while ($this->count) {
- unset($this->ait[$this->count--]);
- }
- $this->ait[0]->rewind();
- $this->ait[0]->recursed = false;
- }
-
- function hasMore()
- {
- $count = $this->count;
- while ($count) {
- $it = $this->ait[$count];
- if ($it->hasMore()) {
- return true;
- }
- $count--;
- }
- return false;
- }
-
- function key()
- {
- $it = $this->ait[$this->count];
- return $it->key();
- }
-
- function current()
- {
- $it = $this->ait[$this->count];
- return $it->current();
- }
-
- function next()
- {
- while ($this->count) {
- $it = $this->ait[$this->count];
- if ($it->hasMore()) {
- if (!$it->recursed && $it->hasChildren()) {
- $it->recursed = true;
- $sub = $it->getChildren();
- $sub->recursed = false;
- $sub->rewind();
- if ($sub->hasMore()) {
- $this->ait[++$this->count] = $sub;
- if (!$sub instanceof RecursiveIterator) {
- throw new Exception(get_class($sub).'::getChildren() must return an object that implements RecursiveIterator');
- }
- return;
- }
- unset($sub);
- }
- $it->next();
- $it->recursed = false;
- if ($it->hasMore()) {
- return;
- }
- $it->recursed = false;
- }
- if ($this->count) {
- unset($this->ait[$this->count--]);
- $it = $this->ait[$this->count];
- }
- }
- }
-
- function getSubIterator($level = NULL)
- {
- if (is_null($level)) {
- $level = $this->count;
- }
- return @$this->ait[$level];
- }
-
- function getDepth()
- {
- return $this->level;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/searchiterator.inc b/ext/spl/examples/searchiterator.inc
deleted file mode 100755
index 1ce5a2eebd..0000000000
--- a/ext/spl/examples/searchiterator.inc
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-abstract class SearchIterator extends FilterIterator
-{
- private $done = false;
-
- function rewind() {
- parent::rewind();
- $this->done = false;
- }
-
- function hasMore() {
- return !$this->done && parent::hasMore();
- }
-
- function next() {
- $this->done = true;
- }
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/seekableiterator.inc b/ext/spl/examples/seekableiterator.inc
deleted file mode 100755
index 7e47009260..0000000000
--- a/ext/spl/examples/seekableiterator.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-
-/** \brief seekable iterator
- *
- * Turns a normal iterator ino a seekable iterator. When there is a way
- * to seek on an iterator LimitIterator can use this to efficiently rewind
- * to offset.
- */
-interface SeekableIterator implements Iterator
-{
- /** Seek to an absolute position
- *
- * \param $index position to seek to
- * \return void
- *
- * \note The method should throw an exception if it is not possible to
- * seek to the given position.
- */
- function seek($index);
-/* $this->rewind();
- $position = 0;
- while($position < $index && $this->hasMore()) {
- $this->next();
- $position++;
- }
- }*/
-}
-
-?> \ No newline at end of file
diff --git a/ext/spl/examples/tree.php b/ext/spl/examples/tree.php
deleted file mode 100755
index 9a61acf942..0000000000
--- a/ext/spl/examples/tree.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/** tree view example
- *
- * Usage: php tree.php <path>
- *
- * Simply specify the path to tree with parameter <path>.
- *
- * (c) Marcus Boerger, 2003
- */
-
-// The following line only operates on classes which are converted to c already.
-// But does not generate a graphical output.
-//foreach(new RecursiveIteratorIterator(new ParentIterator(new RecursiveDirectoryIterator($argv[1])), 1) as $file) {
-
-if ($argc < 2) {
- echo <<<EOF
-Usage: php ${_SERVER['PHP_SELF']} <path>
-
-Displays a graphical tree for the given <path>.
-
-<path> The directory for which to generate the tree graph.
-
-
-EOF;
- exit(1);
-}
-
-echo $argv[1]."\n";
-foreach(new DirectoryGraphIterator($argv[1]) as $file) {
- echo $file . "\n";
-}
-
-?> \ No newline at end of file