From: Fabien Potencier Date: Thu, 24 Jun 2010 21:01:49 +0000 (+0200) Subject: simplified the code a bit X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=032b503c2360e2df73a61b15c0d2d8b19217cb20;p=web%2Fkonrad%2Ftwig.git simplified the code a bit --- diff --git a/lib/Twig/Node.php b/lib/Twig/Node.php index fe0264b..9aa4d34 100644 --- a/lib/Twig/Node.php +++ b/lib/Twig/Node.php @@ -17,7 +17,7 @@ * @author Fabien Potencier * @version SVN: $Id$ */ -class Twig_Node implements Twig_NodeInterface, ArrayAccess, Countable, Iterator +class Twig_Node implements Twig_NodeInterface, ArrayAccess, Countable, IteratorAggregate { protected $nodes; protected $attributes; @@ -224,28 +224,8 @@ class Twig_Node implements Twig_NodeInterface, ArrayAccess, Countable, Iterator return count($this->nodes); } - public function rewind() + public function getIterator() { - reset($this->nodes); - } - - public function current() - { - return current($this->nodes); - } - - public function key() - { - return key($this->nodes); - } - - public function next() - { - return next($this->nodes); - } - - public function valid() - { - return false !== current($this->nodes); + return new ArrayIterator($this->nodes); } }