/** * Load configuration to bootstrap Kernel */ private function loadConfig() { // Read configuration if not already $this->readConfig(); // Databases if (property_exists($this->config, "databases")) { // Database component defined in container? if ($this->container->has("Database")) { $this->setDatabases($this->config->databases); } // Fluent/ORM callback args Schema::setCallbackArgs($this); // Remove databases node from config unset($this->config->databases); } // Site if (property_exists($this->config, "site")) { // Build a URL from given props. if (!property_exists($this->config->site, "url")) { $domain = $this->config->site->domain ?? null; $https = $this->config->site->https ?? null; $port = intval($this->config->site->port ?? 0); if (!empty($domain)) { $this->config->site->url = sprintf('%s://%s%s/', $https === true ? "https" : "http", $domain, $port > 0 ? sprintf(':%d', $port) : ''); } } } // App if (property_exists($this->config, "app")) { // Timezone if (property_exists($this->config->app, "timeZone")) { $this->dateTime->setTimeZone($this->config->app->timeZone); } // Error Handler if (property_exists($this->config->app, "errorHandler")) { // Format if (property_exists($this->config->app->errorHandler, "format")) { $this->errorHandler->setFormat($this->config->app->errorHandler->format); } // Flag for handling triggered error messages $this->errorHandler->setFlag(Kernel::ERRORS_COLLECT); if (property_exists($this->config->app->errorHandler, "hideErrors")) { if (!$this->config->app->errorHandler->hideErrors) { $this->errorHandler->setFlag(Kernel::ERRORS_DEFAULT); } } } // Security if (property_exists($this->config->app, "security")) { // Cipher Component if (isset($this->cipher)) { // Configure Cipher $this->registerCipher(); } // Remove security prop. from config->app unset($this->config->app->security); } // Mailer if ($this->container->has("Mailer")) { // Register Mailer $this->registerMailer(); } // Cache if ($this->container->has("Cache")) { // Register Cache $this->registerCache(); } // Sessions if ($this->container->has("Session")) { // Register Session $this->registerSession(); } // Translator if ($this->container->has("Translator")) { $this->registerTranslator(); } // Knit if ($this->container->has("Knit")) { $this->registerKnit(); } } }