Example #1
0
 public static function getDefault() : UrlParameter
 {
     return new static(Config::get('app.languages.default'));
 }
Example #2
0
 /**
  * @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();
 }