Browse Source

trim route finder iterator instantiation.

Taylor Otwell 13 years ago
parent
commit
5b86ad6067
1 changed files with 7 additions and 3 deletions
  1. 7 3
      system/route/finder.php

+ 7 - 3
system/route/finder.php

@@ -42,7 +42,9 @@ class Finder {
 			return static::$names[$name];
 		}
 
-		$recursiveIterator = new \RecursiveIteratorIterator($arrayIterator = new \RecursiveArrayIterator(static::$routes));
+		$arrayIterator = new \RecursiveArrayIterator(static::$routes);
+
+		$recursiveIterator = new \RecursiveIteratorIterator($arrayIterator);
 
 		foreach ($recursiveIterator as $iterator)
 		{
@@ -67,9 +69,11 @@ class Finder {
 	{
 		$routes = array();
 
-		$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(APP_PATH.'routes'), \RecursiveIteratorIterator::SELF_FIRST);
+		$directoryIterator = new \RecursiveDirectoryIterator(APP_PATH.'routes');
+
+		$recursiveIterator = new \RecursiveIteratorIterator($directoryIterator, \RecursiveIteratorIterator::SELF_FIRST);
 
-		foreach ($iterator as $file)
+		foreach ($recursiveIterator as $file)
 		{
 			if (filetype($file) === 'file')
 			{