public static function factory($name) { $ref = new Joy_Reflection($name); if (!$ref->isA(Joy_Page_Interface)) { throw new Joy_Exception_NotFound_Page("Page Not Found ({$name})"); } return $ref->newInstance(); }
public function getController($name) { if (!$this->_controllers[$name] instanceof Joy_Controller_Interface) { $ref = new Joy_Reflection($name); if ($ref->isA(Joy_Controller_Interface)) { $this->_controllers[$name] = $ref->newInstance(); } } return $this->_controllers[$name]; }
/** * factory method is adapter factory * * @param string $adapterName * @return Dahius_VirtualPos_Interface */ public function factory($adapterName) { if (empty($adapterName)) { throw new VPosException("AdapterName not set"); } if (!array_key_exists($adapterName, $this->_adapters)) { throw new VPosException("AdapterName({$adapterName}) not found"); } $adapter = $this->_adapters[$adapterName]["adapter"]; $params = $this->_adapters[$adapterName]["parameters"]; $ref = new Joy_Reflection($adapter); return $ref->newInstance(array($adapterName, $params)); }
/** * getInstance * * @return void */ public static function getInstance() { if (!is_object(self::$_instance)) { $config = Joy_Config::getInstance(); $session_provider = $config->application->get("application/session"); if (null == $session_provider) { $session_provider = "Joy_Context_Session_Local"; } $ref = new Joy_Reflection($session_provider); self::$_instance = $ref->newInstance(); } return self::$_instance; }
public function _init() { $this->auth = false; $this->_membership = $this->config->application->get("application/membership"); if ($this->_membership && $this->_membership["provider"]) { $ref = new Joy_Reflection($this->_membership["provider"]); $this->provider = $ref->newInstance(); } $this->acl = new Joy_Membership_Acl(); // Role, Resource and Alloweds $this->profiles = new Joy_Membership_Profile(); // Joy_Membership_Role; // Joy_Membership_Profile; // Joy_Membership_User; }
public function __toString() { $render = Joy_Context_Response::getInstance()->getRender(); $output = ""; foreach ($this->_stack as $stack) { try { list($class, $params) = each($stack); $ref = new Joy_Reflection($class); $view = $ref->newInstance(array($params)); $output .= $render->execute($view); } catch (Exception $ex) { $output .= $ex->getMessage(); } } return $output; }
public function action($name, $arguments = array()) { //TODO: Check Permission $action_info = explode('.', $name); $action = array_shift($action_info); $hasWidget = (bool) ("widget" == strtolower(array_shift($action_info))); if ($hasWidget) { $action[0] = strtoupper($action[0]); $widgetClass = sprintf("%s_%s_%s", get_class($this), $this->getWidgetFolder(), $action); $widget = new Joy_Reflection($widgetClass); return $widget->newInstance($arguments); } else { return parent::action($action, $arguments); } # $view = Joy_View($template, # $this->assign; # var_dump($hasWidget, $action); }
public function __construct($app_dir, $app_env = null) { parent::__construct(); $this->config->application->set("folders/root", $app_dir); $this->config->application->loadConfig($app_env); // set library include path $this->setIncludePath($this->config->application->get("folders/library")); // set controller include path $this->setIncludePath($this->config->application->get("folders/controller")); $this->router = Joy_Router::getInstance(); // Bootstrap Loader... $bootstrap = $this->config->application->get("application/bootstrap"); if ($bootstrap) { $ref = new Joy_Reflection($bootstrap); $object = $ref->newInstance(); } if (!$object instanceof Joy_Application_Bootstrap) { $object = new Joy_Application_Bootstrap(); } }
/** * factory static method is instance controller * * @param string $name is controller class name * @return Joy_Controller */ public static function factory($name) { $ref = new Joy_Reflection($name); return $ref->newInstance(); }
public function setBootstrap($class) { $ref = new Joy_Reflection($class); $ref->newInstance(array($this->_connection)); }
public static function newInstance($class) { $ref = new Joy_Reflection($class); return $ref->newInstance(); }