From 032b503c2360e2df73a61b15c0d2d8b19217cb20 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 24 Jun 2010 23:01:49 +0200 Subject: [PATCH] simplified the code a bit --- lib/Twig/Node.php | 26 +++----------------------- 1 files changed, 3 insertions(+), 23 deletions(-) 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); } } -- 1.7.2.5