public function createApplication($namespace = 'Staq\\Core\\Ground', $baseUri = NULL, $platform = NULL) { if (empty($baseUri)) { $baseUri = $this->getDefaultBaseUri(); } if (empty($platform)) { $platform = 'prod'; if (\Staq\Util::isCli()) { if (!isset($argv[1])) { echo 'You must specify a platform.' . PHP_EOL; echo 'Ex: ' . $argv[0] . ' local' . PHP_EOL; die; } $platform = $argv[1]; } } $extensions = $this->findExtensions($namespace); if (!is_null(static::$autoloader)) { spl_autoload_unregister(array(static::$autoloader, 'autoload')); } static::$autoloader = new \Staq\Autoloader($extensions); spl_autoload_register(array(static::$autoloader, 'autoload')); static::$application = new \Stack\Application($extensions, $baseUri, $platform); static::$application->initialize(); return static::$application; }
public function initialize() { $this->settings = (new \Stack\Setting())->clearCache()->parse($this); // Display errors $displayErrors = 0; if ($this->settings->getAsBoolean('error.display_errors') || \Staq\Util::isCli()) { $displayErrors = 1; } ini_set('display_errors', $displayErrors); // Level reporting if (\Staq\Util::isCli()) { $level = E_ALL & ~E_STRICT; } else { $level = $this->settings->get('error.error_reporting'); if (!is_numeric($level)) { $level = 0; } } error_reporting($level); // Timezone $timezone = $this->settings->get('service.timezone'); date_default_timezone_set($timezone); $this->initialized = TRUE; return $this; }