Exemple #1
0
 public function setException($e)
 {
     $error = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
     $exceptionType = get_class($e);
     $error->exception = $e;
     $error->type = $exceptionType;
     Factory::find('Elephant\\Base\\Request')->setParam('error_handle', $error);
     Factory::find('Elephant\\Foundation\\Application')->setDispatched(false);
     Factory::find('Elephant\\Foundation\\Application')->setControllerName($this->getErrorControllerName())->setActionName($this->getErrorActionName())->dispatch();
     Factory::find('Elephant\\Foundation\\View')->renderView();
 }
Exemple #2
0
 protected function addDefaultRoutes()
 {
     $handle = Factory::find('Elephant\\Foundation\\DefaultRoute');
     $this->_routers = array_merge(array('default' => $handle), $this->_routers);
 }
Exemple #3
0
 protected function getViewScript($spec)
 {
     $action = self::getScriptAction();
     if (NULL == $action) {
         $action = Application::$curAction;
     }
     $controller = Application::$curController;
     $suffix = $this->getViewSuffix();
     $viewPath = dirname(Factory::find('Elephant\\Foundation\\Application')->getControllerPath());
     $replacements = array(':controller' => str_replace($this->_delimiters, '-', strtolower($controller)), ':action' => str_replace($this->_delimiters, '-', strtolower($action)), ':suffix' => $suffix);
     $value = str_replace(array_keys($replacements), array_values($replacements), $spec);
     $value = preg_replace('/-+/', '-', $value);
     return $value;
 }
Exemple #4
0
 protected function processException($e)
 {
     if ($this->throwException()) {
         throw $e;
     }
     Factory::find('Elephant\\Base\\Exception')->setException($e);
 }
Exemple #5
0
 public function initView()
 {
     $this->view = Factory::find('Elephant\\Foundation\\View');
 }