Skip to content

Commit

Permalink
Added return $this for method chaining.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpustulka committed May 8, 2017
1 parent 6eb6968 commit 907075c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Core/ObjectRegistry.php
Expand Up @@ -262,13 +262,15 @@ public function normalizeArray($objects)
*
* If the registry subclass has an event manager, the objects will be detached from events as well.
*
* @return void
* @return $this
*/
public function reset()
{
foreach (array_keys($this->_loaded) as $name) {
$this->unload($name);
}

return $this;
}

/**
Expand All @@ -279,7 +281,7 @@ public function reset()
*
* @param string $objectName The name of the object to set in the registry.
* @param object $object instance to store in the registry
* @return void
* @return $this
*/
public function set($objectName, $object)
{
Expand All @@ -293,6 +295,8 @@ public function set($objectName, $object)
$this->eventManager()->on($object);
}
$this->_loaded[$name] = $object;

return $this;
}

/**
Expand All @@ -301,7 +305,7 @@ public function set($objectName, $object)
* If this registry has an event manager, the object will be detached from any events as well.
*
* @param string $objectName The name of the object to remove from the registry.
* @return void
* @return $this
*/
public function unload($objectName)
{
Expand All @@ -315,6 +319,8 @@ public function unload($objectName)
$this->eventManager()->off($object);
}
unset($this->_loaded[$objectName]);

return $this;
}

/**
Expand Down

0 comments on commit 907075c

Please sign in to comment.