SlimCMS\Helpers\ConfigWorker::loadEnvFiles PHP Method

loadEnvFiles() public static method

Load configuration files
public static loadEnvFiles ( array $arConfig = [] ) : void | null
$arConfig array
return void | null
    public static function loadEnvFiles(array $arConfig = [])
    {
        if (is_object(self::$folders)) {
            return;
        }
        $arDefault = ["enviroment" => "local", "configFolderName" => "config", "compileFolderName" => "config", "blockCacheFile" => ".blockCache"];
        $arConfig = array_merge($arDefault, $arConfig);
        self::$folders = new \stdClass();
        self::$folders->environment = $arConfig["enviroment"];
        if (is_file(ROOT_PATH . '.env')) {
            self::$folders->environment = file_get_contents(ROOT_PATH . '.env');
        }
        self::$folders->baseConfigPath = APP_PATH . $arConfig["configFolderName"] . '/';
        self::$folders->realConfigPath = self::$folders->baseConfigPath . self::$folders->environment . "/";
        if (!is_dir(self::$folders->realConfigPath)) {
            self::$folders->realConfigPath = self::$folders->baseConfigPath . $arConfig["enviroment"] . "/";
        }
        self::$folders->cacheConfigPath = CACHE_PATH . $arConfig["compileFolderName"] . "/";
        self::$folders->cacheConfigFile = self::$folders->cacheConfigPath . self::$folders->environment . ".php";
        self::$folders->blockConfigCache = is_file(self::$folders->cacheConfigPath . $arConfig["blockCacheFile"]);
    }