Forked from beberlei/Whitewashing_Controller_Helper_Container.php
Created
July 10, 2009 10:39
-
-
Save noginn/144397 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Whitewashing | |
* | |
*/ | |
class Whitewashing_Controller_Helper_Container extends Zend_Controller_Action_Helper_Abstract | |
{ | |
/** | |
* @var Yadif_Container | |
*/ | |
protected $_container = null; | |
public function init() | |
{ | |
$this->_container = $this->_actionController->getInvokeArg('bootstrap')->getContainer(); | |
} | |
/** | |
* @param string $resource | |
* @return object | |
*/ | |
public function direct($resource) | |
{ | |
$object = $this->_container->$resource; | |
if($object == null) { | |
throw new Exception( | |
"Unknown resource '".$resource."' accessed." | |
); | |
} | |
return $object; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment