Skip to content

Commit

Permalink
Add ObjectRegistry::get() and alternative to magic ObjectRegistry::__…
Browse files Browse the repository at this point in the history
…get().
  • Loading branch information
ADmad committed Nov 26, 2014
1 parent e8ded81 commit b861791
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/Core/ObjectRegistry.php
Expand Up @@ -185,18 +185,28 @@ public function has($name) {
}

/**
* Provide public read access to the loaded objects
* Get loaded object instance.
*
* @param string $name Name of property to read
* @return mixed
* @param string $name Name of object.
* @return object|null Object instance if loaded else null.
*/
public function __get($name) {
public function get($name) {
if (isset($this->_loaded[$name])) {
return $this->_loaded[$name];
}
return null;
}

/**
* Provide public read access to the loaded objects
*
* @param string $name Name of property to read
* @return mixed
*/
public function __get($name) {
return $this->get($name);
}

/**
* Provide isset access to _loaded
*
Expand Down

0 comments on commit b861791

Please sign in to comment.