From 2ff8d7a8bc067901ecbc64599b86d1b325f5fe98 Mon Sep 17 00:00:00 2001 From: Jakob Sack Date: Fri, 29 Jul 2011 21:03:53 +0200 Subject: One class per file! --- lib/fakedirstream.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/fakedirstream.php (limited to 'lib/fakedirstream.php') diff --git a/lib/fakedirstream.php b/lib/fakedirstream.php new file mode 100644 index 00000000000..fa3e64da62c --- /dev/null +++ b/lib/fakedirstream.php @@ -0,0 +1,45 @@ +name=substr($path,strlen('fakedir://')); + $this->index=0; + if(isset($FAKEDIRS[$this->name])){ + $this->data=$FAKEDIRS[$this->name]; + }else{ + $this->data=array(); + } + return true; + } + + public function dir_readdir(){ + if($this->index>=count($this->data)){ + return false; + } + $filename=$this->data[$this->index]; + $this->index++; + return $filename; + } + + public function dir_closedir() { + $this->data=false; + $this->name=''; + return true; + } + + public function dir_rewinddir() { + $this->index=0; + return true; + } +} + +stream_wrapper_register("fakedir", "fakeDirStream"); + -- cgit v1.2.3