Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
4 / 4 |
| DirectoryHandler | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
4 / 4 |
| setDirectory(Directory $directory) | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| iterator() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| /* | |
| * This file is part of the php-vfs package. | |
| * | |
| * (c) Michael Donat <michael.donat@me.com> | |
| * | |
| * For the full copyright and license information, please view the LICENSE | |
| * file that was distributed with this source code. | |
| */ | |
| namespace VirtualFileSystem\Wrapper; | |
| use VirtualFileSystem\Structure\Directory; | |
| /** | |
| * User as directory handle by streamWrapper implementation. | |
| * | |
| * This class is responsible mainly iterating over directory. | |
| * | |
| * @author Michael Donat <michael.donat@me.com> | |
| * @package php-vfs | |
| */ | |
| class DirectoryHandler | |
| { | |
| /** | |
| * @var Directory | |
| */ | |
| protected $directory; | |
| /** | |
| * @var ArrayIterator | |
| */ | |
| protected $iterator; | |
| /** | |
| * Sets directory in context. | |
| * | |
| * @param Directory $directory | |
| */ | |
| public function setDirectory(Directory $directory) | |
| { | |
| $this->directory = $directory; | |
| $this->iterator = new \ArrayIterator($directory->children()); | |
| } | |
| /** | |
| * Returns children iterator | |
| * | |
| * @return ArrayIterator | |
| */ | |
| public function iterator() | |
| { | |
| return $this->iterator; | |
| } | |
| } |