1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace Cube\Controller\Action\Helper;
- use Cube\Controller\Action\AbstractAction;
- class Broker
- {
-
- protected $_action;
-
- public function __construct(AbstractAction $action)
- {
- $this->_action = $action;
- }
-
- public function getHelper($name)
- {
- $className = '\\' . __NAMESPACE__ . '\\' . ucfirst($name);
- if (class_exists($className)) {
-
- $helper = new $className();
- $helper->setAction($this->_action);
- }
- else {
- throw new \InvalidArgumentException(
- sprintf("The action helper '%s' does not exist.", $className));
- }
- return $helper;
- }
-
- public function __call($name, $arguments)
- {
- return $this->getHelper($name);
- }
- }
|