diff options
author | emkael <emkael@tlen.pl> | 2017-01-18 20:07:16 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-01-18 20:07:16 +0100 |
commit | 9a9c04512e5dcb77c7fe5d850e3f2a0250cc160e (patch) | |
tree | fed46b5f4c2ed3a050bb1a7ad7c6d0a3ea844d55 /lib/querypath/src/QueryPath/QueryPathIterator.php | |
parent | c5bcf8f74fb80b7e163663845b0d6e35cabface3 (diff) |
* Motor Sport Magazine feed provider
Diffstat (limited to 'lib/querypath/src/QueryPath/QueryPathIterator.php')
-rw-r--r-- | lib/querypath/src/QueryPath/QueryPathIterator.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/querypath/src/QueryPath/QueryPathIterator.php b/lib/querypath/src/QueryPath/QueryPathIterator.php new file mode 100644 index 0000000..be2e66f --- /dev/null +++ b/lib/querypath/src/QueryPath/QueryPathIterator.php @@ -0,0 +1,33 @@ +<?php +/** + * @file + * + * Utility iterator for QueryPath. + */ +namespace QueryPath; + +/** + * An iterator for QueryPath. + * + * This provides iterator support for QueryPath. You do not need to construct + * a QueryPathIterator. QueryPath does this when its QueryPath::getIterator() + * method is called. + * + * @ingroup querypath_util + */ +class QueryPathIterator extends \IteratorIterator { + public $options = array(); + private $qp = NULL; + + public function current() { + if (!isset($this->qp)) { + $this->qp = \QueryPath::with(parent::current(), NULL, $this->options); + } + else { + $splos = new \SplObjectStorage(); + $splos->attach(parent::current()); + $this->qp->setMatches($splos); + } + return $this->qp; + } +} |