Example #1
0
 /**
  * Конструктор фронт контроллера
  * @param $config_path string к конфигурационному файлу
  */
 public function __construct($config_path)
 {
     $config = (include_once $config_path);
     $run_mode = $config["mode"];
     self::$logger = Logger::getLogger($this->configureLogParams($run_mode, $config["log"]));
     Service::set("logger", self::$logger);
     self::$logger->debug("Run mode set to " . $run_mode);
     $this->setErrorReportingLevel($run_mode);
     $this->router = new Router($config["routes"]);
     $this->pdo = Database::getInstance($config["pdo"]);
     Service::setAll($config["di"]);
     Service::set("router", $this->router);
     Service::set("pdo", $this->pdo->getConnection());
     Service::set("config", $config);
     $this->config = $config;
     //TODO добавить обработку остальных параметров конфига, когда понядобятся
 }