// try to write log errorLog($e['message'], $e['file'] . "#" . $e['line']); exit(1); } // Shutdown function for handle critical and other errors register_shutdown_function('\\Application\\errorDisplay'); // Try to run application try { /** * @var \Composer\Autoload\ClassLoader $loader * @see http://getcomposer.org/apidoc/master/Composer/Autoload/ClassLoader.html */ require_once dirname(__DIR__) . '/vendor/autoload.php'; // Environment $env = getenv('BLUZ_ENV') ?: 'production'; $app = CliBootstrap::getInstance(); $app->init($env); $app->process(); $app->render(); $app->finish(); } catch (Exception $e) { echo "Application Exception\n"; if (getenv('BLUZ_DEBUG')) { echo strip_tags($e->getMessage()) . "\n\n"; echo "# --- \n"; echo $e->getTraceAsString() . "\n"; echo "# --- \n"; } else { echo "Use `--help` flag for show help notices\n"; echo "Use `--debug` flag for receive more information\n"; }
/** * @param type $DI * @param array $options * @return mixed|type|void * @throws \Exception */ public static function run($DI, $options = array()) { $cliBootstrap = new CliBootstrap($DI); return $cliBootstrap->run($options); }