Skip to content

Commit

Permalink
Added the ability to iterate over registry objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpustulka committed May 8, 2017
1 parent 0969847 commit 15a7e6f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Core/ObjectRegistry.php
Expand Up @@ -14,8 +14,10 @@
*/
namespace Cake\Core;

use ArrayIterator;
use Cake\Event\EventDispatcherInterface;
use Cake\Event\EventListenerInterface;
use IteratorAggregate;
use RuntimeException;

/**
Expand All @@ -34,7 +36,7 @@
* @see \Cake\View\HelperRegistry
* @see \Cake\Console\TaskRegistry
*/
abstract class ObjectRegistry
abstract class ObjectRegistry implements IteratorAggregate
{

/**
Expand Down Expand Up @@ -346,6 +348,16 @@ public function unload($objectName)
return $this;
}

/**
* Returns an array iterator.
*
* @return \ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->_loaded);
}

/**
* Debug friendly object properties.
*
Expand Down

0 comments on commit 15a7e6f

Please sign in to comment.