doc module: Add `DocIterator::count()'

Method used to count available markdown documentation files.

refs #4820
This commit is contained in:
Eric Lippmann 2014-06-30 15:22:32 +02:00
parent a8e6dda783
commit c48f7f9fba
1 changed files with 7 additions and 1 deletions

View File

@ -34,11 +34,12 @@ class FileLockingIterator extends ArrayIterator
} }
} }
use Countable;
use IteratorAggregate; use IteratorAggregate;
use RecursiveIteratorIterator; use RecursiveIteratorIterator;
use RecursiveDirectoryIterator; use RecursiveDirectoryIterator;
class DocIterator implements IteratorAggregate class DocIterator implements Countable, IteratorAggregate
{ {
protected $fileInfos; protected $fileInfos;
@ -54,6 +55,11 @@ class DocIterator implements IteratorAggregate
$this->fileInfos = $fileInfos; $this->fileInfos = $fileInfos;
} }
public function count()
{
return count($this->fileInfos);
}
public function getIterator() public function getIterator()
{ {
return new FileLockingIterator($this->fileInfos); return new FileLockingIterator($this->fileInfos);