From 0be18e763a4f7cb9e2c2c60f826d1c7df77d1b82 Mon Sep 17 00:00:00 2001 From: Etienne Roudeix Date: Tue, 25 Jun 2013 08:55:08 +0200 Subject: [PATCH] correct use of type and argument collections --- .../lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php | 7 +------ core/lib/Thelia/Type/TypeCollection.php | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php index 88146317b..67ccfcf98 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/TheliaLoop.php @@ -219,12 +219,7 @@ class TheliaLoop implements SmartyPluginInterface $faultDetails = array(); $argumentsCollection = $loop->defineArgs(); - $argumentsCollection->rewind(); - - while ($argumentsCollection->valid()) { - - $argument = $argumentsCollection->current(); - $argumentsCollection->next(); + foreach( $argumentsCollection as $argument ) { $value = isset($smartyParam[$argument->name]) ? $smartyParam[$argument->name] : null; diff --git a/core/lib/Thelia/Type/TypeCollection.php b/core/lib/Thelia/Type/TypeCollection.php index ebbd3274b..4430be5df 100755 --- a/core/lib/Thelia/Type/TypeCollection.php +++ b/core/lib/Thelia/Type/TypeCollection.php @@ -124,15 +124,10 @@ class TypeCollection implements \Iterator */ public function isValid($value) { - $this->rewind(); - while ($this->valid()) { - $type = $this->current(); - + foreach($this as $type) { if($type->isValid($value)) { return true; } - - $this->next(); } return false;