setIsDevelopmentServer($is_development_server); } public function setIsDevelopmentServer($is_development_server): void { $this->is_development_server = (bool) $is_development_server; } public function getIsDevelopmentServer(): bool { return $this->is_development_server; } /** * Read config values from ini file * * @param string $filename Path to ini file * @return void */ public function readFromIniFile(string $filename): void { if (!file_exists($filename) || !is_readable($filename)) { throw new \Exception("Cannot read config file '$filename'"); } $ini = parse_ini_file($filename); $this->readFromArray($ini); } /** * Read config values from array * * @param array $data Array of config values * @return void */ public function readFromArray(array $params): void { $valid_keys = [ 'host', 'port', 'hostname', 'tls_certfile', 'tls_keyfile', 'key_passphrase', 'log_file', 'log_level', 'root_dir', 'index_file', 'enable_directory_index', ]; foreach ($params as $key => $value) { if (!in_array($key, $valid_keys)) { continue; } $this->{$key} = $value; } } }