* * @param string $name Name of loaded target with or without namespace * @return null */ spl_autoload_register(function ($name) { $name = ltrim($name, '\\'); if (strpos($name, '\\', 1)) { $name = str_replace('\\', '/', $name); $path = APPLICATION . $name . '.php'; if (!is_file($path)) { throw new SystemErrorException(array('title' => 'Autoload error', 'description' => 'File ' . $path . ' is not exists')); } } else { $path = $name . '.php'; } require $path; }, false); // Run application try { $isCLI = PHP_SAPI == 'cli'; App::init($useMemory, $startTime, $isCLI); Member::beforeInit(); View::init(); if ($isCLI) { CliEnv::init($argv); } App::run(); } catch (Exception $e) { View::assignException($e); } View::draw();