Continued a bit:
[core.git] / framework / main / classes / registry / class_BaseRegistry.php
index 9d47a9a1509a6a5bcacbbf4df83452215e7498c5..7c79ce3b3e40898ddce87bcd399c80b24b21bcc2 100644 (file)
@@ -3,9 +3,13 @@
 namespace CoreFramework\Registry;
 
 // Import framework stuff
+use CoreFramework\Factory\ObjectFactory;
 use CoreFramework\Generic\NullPointerException;
 use CoreFramework\Object\BaseFrameworkSystem;
 
+// Import SPL stuff
+use \IteratorAggregate;
+
 /**
  * A general Registry
  *
@@ -28,7 +32,7 @@ use CoreFramework\Object\BaseFrameworkSystem;
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-class BaseRegistry extends BaseFrameworkSystem implements Registerable {
+class BaseRegistry extends BaseFrameworkSystem implements Register, Registerable, IteratorAggregate {
        /**
         * Glue for generating a registry key
         */
@@ -49,8 +53,19 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable {
                // Call parent constructor
                parent::__construct($className);
 
-               // Init raw array
+               // Init generic arrays
                $this->initGenericArrayGroup('raw', 'generic');
+               $this->initGenericArrayGroup('raw', 'instance');
+       }
+
+       /**
+        * Returns an iterator for this whole registry.
+        *
+        * @return      $iteratorInstance       An instance of a Iterator class
+        */
+       public function getIterator () {
+               // Instance + return it
+               return ObjectFactory::createObjectByConfiguredName('registry_iterator_class', array($this));
        }
 
        /**
@@ -182,7 +197,7 @@ class BaseRegistry extends BaseFrameworkSystem implements Registerable {
                } // END - foreach
 
                // Debug message
-               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: Returning entry(' . count($entry) . ')=' . print_r($entry, TRUE));
+               //* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: Returning entry(' . count($entry) . ')=' . print_r($entry, true));
 
                // Return it
                return $entry;