コード例 #1
0
 /**
  * @param string|TextResponse $message : the error message to display
  * @param int $code : the HTTP response code
  */
 public function __construct($message, int $code = 500)
 {
     if (!Config::getBool('debug')) {
         // only show the full error message in debug environments
         $message = '<h1>Internal server error</h1>';
         $code = 500;
     }
     parent::__construct($message);
     $this->code = $code;
 }
コード例 #2
0
ファイル: Language.php プロジェクト: jurchiks/simpleframe
 public static function getDefault() : UrlParameter
 {
     return new static(Config::get('app.languages.default'));
 }
コード例 #3
0
ファイル: App.php プロジェクト: jurchiks/simpleframe-core
 /**
  * @param string $rootDir : the root directory of the project
  */
 public static function run(string $rootDir)
 {
     if (!is_dir($rootDir . '/app/')) {
         throw new RuntimeException('Invalid root directory, must contain /app/');
     }
     define('ROOT_DIR', $rootDir);
     define('LOG_DIR', ROOT_DIR . '/logs');
     self::init();
     // user initializers, event bindings, etc
     if (file_exists(ROOT_DIR . '/app/bootstrap.php')) {
         require ROOT_DIR . '/app/bootstrap.php';
     }
     // routes
     if (file_exists(ROOT_DIR . '/app/routes.php')) {
         require ROOT_DIR . '/app/routes.php';
     } else {
         throw new RuntimeException('No routes defined, what do you expect to see here?');
     }
     $timezone = Config::get('timezone');
     if (!empty($timezone)) {
         date_default_timezone_set($timezone);
     }
     self::render();
 }