Ejemplo n.º 1
0
 /**
  * Init the namespaces of the
  * projects
  */
 protected final function initNamespaces()
 {
     $autoloader = $this->application->getAutoloader();
     foreach (ProjectManager::getProjects() as $project) {
         $autoloader->addPsr4(rtrim($project->getNsName(), '\\') . '\\', $project->getNsPath());
     }
 }
Ejemplo n.º 2
0
 public function handleShutdown()
 {
     $isError = false;
     $type = "UnknownError";
     if ($error = error_get_last()) {
         switch ($error['type']) {
             case E_ERROR:
                 $type = "FatalError";
                 $isError = true;
             case E_CORE_ERROR:
                 $type = "CoreError";
                 $isError = true;
             case E_COMPILE_ERROR:
                 $type = "CompileError";
                 $isError = true;
             case E_USER_ERROR:
                 $type = "UserError";
                 $isError = true;
             case E_PARSE:
                 $type = "ParseError";
                 $isError = true;
                 break;
         }
         if ($isError) {
             // Create new exception
             $className = '\\' . ProjectManager::getDefaultProject()->getNsName();
             $className .= '\\Handler\\Error\\Exception\\Shutdown\\' . $type . 'Exception';
             $exception = new $className();
             if (false == is_null($exception)) {
                 $message = array_key_exists('message', $error) ? $error['message'] : $type;
                 $exception->setMessage(self::SHUTDOWN_ERROR_MESSAGE . ": " . $message);
                 // Define position
                 if (array_key_exists('line', $error) && array_key_exists('file', $error)) {
                     $exception->setFile($error['file']);
                     $exception->setLine($error['line']);
                 }
                 // Render new application after wipeout
                 Application::renderShutdownError($exception);
             }
         }
     }
 }