Load env file

@param string $filename

@return void
@throws
555269
public static function load($filename)
    {
        if (static::$env != null) {
            return;
        }

        static::$env = json_decode(trim(file_get_contents($filename)), true);

        if (json_last_error() == JSON_ERROR_SYNTAX) {
            throw new \ErrorException('');
        }

        if (json_last_error() == JSON_ERROR_INVALID_PROPERTY_NAME) {
            throw new \ErrorException('Check environment file json syntax (.env.json)');
        }

        if (json_last_error() != JSON_ERROR_NONE) {
            throw new \ErrorException(json_last_error_msg());
        }
    }
2084
protected function load($filename)
    {
        $lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        if ($lines === false) {
            throw new \InvalidArgumentException('Invalid file');
        }

        $entry      = self::newEntry();
        $lastKw     = null;
        $lastIndex  = null;

        foreach ($lines as $line) {
            if ($line[0] === '#') {
                $this->maybePushEntry($entry);
                if (strlen($line) === 1) {
                    continue;
                }
                switch ($line[1]) {
                    case ' ':   # Translator comment
                        break;
                    case '.':   # Extracted comment
                        break;
                    case ':':   # File/line reference
                        break;
                    case ',':   # Flags
                        break;
                    case "|":   # Previous information
                        # The initial marker is followed by a keyword
                        # (either "msgid", "msgctxt" or "msgid_plural"),
                        # detailing what the previous information was.
                        break;
                }
                continue;
            }

            $line   = ltrim($line, " \t");
            $len    = strlen($line);

            // Reset keyword index on new entry
            if (!count($entry['msgstr'])) {
                $lastIndex = null;
            }

            // Look for continuation strings.
            if (strlen($line) >= 2 && $line[0] === '"' && $line[$len-1] === '"') {
                // We found a string, but it has no predecessor.
                if ($lastKw === null) {
                    throw new \InvalidArgumentException();
                }

                $line   = stripcslashes((string) substr($line, 1, -1));

                if ($lastKw === 'msgstr') {
                    $index = $lastIndex === null ? 0 : $lastIndex;
                } else {
                    $index = null;
                }

                if ($index === null) {
                    if (is_array($entry[$lastKw])) {
                        throw new \InvalidArgumentException();
                    } else {
                        $entry[$lastKw] .= $line;
                    }
                } else {
                    if (!is_array($entry[$lastKw])) {
                        throw new \InvalidArgumentException();
                    } else {
                        $entry[$lastKw][$index] .= $line;
                    }
                }
                continue;
            }

            $kwLen  = strcspn($line, " \t");
            $kw     = (string) substr($line, 0, $kwLen);
            $index  = null;
            $line   = ltrim((string) substr($line, $kwLen), " \t");

            $brkOpen    = strpos($kw, '[');
            $brkClose   = strpos($kw, ']');
            if ($brkOpen !== false || $brkClose !== false) {
                if ($brkOpen === false || $brkClose === false || $brkClose < $brkOpen) {
                    throw new \InvalidArgumentException();
                }

                $nlen = strspn($kw, '1234567890', $brkOpen + 1, $brkClose - $brkOpen - 1);
                if ($nlen === 0 || $nlen !== $brkClose - $brkOpen - 1) {
                    throw new \InvalidArgumentException();
                }

                $index  = (int) substr($kw, $brkOpen + 1, $nlen);
                $kw     = (string) substr($kw, 0, $brkOpen);
            }

            if (strlen($line) < 2 || $line[0] !== '"' || $line[strlen($line)-1] !== '"') {
                throw new \InvalidArgumentException();
            }
            $line = stripcslashes((string) substr($line, 1, -1));

            switch ($kw) {
                case "msgstr":
                    if ($index === null) {
                        if (isset($entry[$kw][0])) {
                            throw new \InvalidArgumentException();
                        }
                        $entry[$kw][0] = $line;
                    } else {
                        if (array_key_exists($index, $entry[$kw])) {
                            throw new \InvalidArgumentException();
                        }
                        $entry[$kw][$index] = $line;
                        $lastIndex = $index;
                    }
                    break;

                case "msgctxt":
                    // Intentional fall-through
                case "msgid":
                    $this->maybePushEntry($entry);
                    // Intentional fall-through
                case 'msgid_plural':
                    if ($index !== null || isset($entry[$kw])) {
                        throw new \InvalidArgumentException();
                    }
                    $entry[$kw] = $line;
                    break;

                default:
                    throw new \InvalidArgumentException();
            }
            $lastKw = $kw;
        }

        // Push the last entry.
        $this->maybePushEntry($entry);
    }
1189387
public function load($filename)
    {
        $json = file_get_contents($filename);
        if (false === $json) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException("Unable to load file {$filename}");
            // @codeCoverageIgnoreEnd
        }

        $data = Utils::jsonDecode($json, true);
        if (is_array($data)) {
            foreach (Utils::jsonDecode($json, true) as $cookie) {
                $this->setCookie(new SetCookie($cookie));
            }
        } elseif (strlen($data)) {
            throw new \RuntimeException("Invalid cookie file: {$filename}");
        }
    }
513949
private function loadResourceFiles($filenames)
    {
        if (!is_array($filenames)) {
            $filenames = array($filenames);
        }

        foreach ($filenames as $glob) {
            $globs = glob(str_replace('[', '[[]', $glob));
            if ($globs) {
                foreach ($globs as $filename) {
                    require_once $filename;
                }
            }
        }
    }
557246
public function loadConfig($file, $env = self::ENV_COMMON)
    {
        $this->loadConfigFile($file, $env, false);
    }
705793
public static function loadFile($fileName)
  {
    if (!preg_match('/\.ini$/i', $fileName)) {
      $fileName .= '.ini';
    }
    if (!static::isFileLoaded($fileName)) {
      self::$files[] = $fileName;
      return static::loadFileInMemory($fileName);
    }
    return false;
  }
981473
public function load($path = null, $filename = null)
    {
        $this->path     = isset($path) ? $path : $this->path;
        $this->filename = isset($filename) ? $filename : $this->filename;

        if (is_file($this->path.'/'.$this->filename))
        {
            $this->settings = json_decode(file_get_contents($this->path.'/'.$this->filename), true);
        }
        else
        {
            $this->settings = [];
        }

        return $this;
    }
204853
public function load($environment = null)
    {
        foreach ($this->loader->load($environment) as $key => $value) {
            $_ENV[$key] = $value;

            $_SERVER[$key] = $value;

            putenv("{$key}={$value}");
        }
    }
1065838
public function loadFile($filename)
    {
        $templateDir = Eresus_Kernel::app()->getFsRoot();
        $template = $templateDir . '/' . $filename;
        $this->template = new TemplateFile($template, null, $filename, $filename);
    }
695900
public function loadResource($resourceName)
		{
			$resourceLocation = dirname(__FILE__).DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."res".DIRECTORY_SEPARATOR.$resourceName;
			$this->resourceContent = $this->readResourceToArray($resourceLocation);
		}
750834
private function loadFile(
        array &$items,
        string $path,
        string $pathRelative,
        string $configKey,
        $environment = null
    ): void {
        // Build filename.
        $filename = $path;
        if ($pathRelative !== null && $pathRelative !== '') {
            $filename .= '/' . $pathRelative;
        }
        $filename .= '/' . $configKey;
        if ($environment !== null) {
            $filename .= '.' . (string)$environment;
        }
        $filename .= '.php';

        // Load configuration.
        if (!file_exists($filename)) {
            return;
        }
        $config = require($filename);

        // Parse config.
        $itemsData = &$items;
        if ($pathRelative !== '') {
            $pathSegments = explode('.', $pathRelative);
            foreach ($pathSegments as $pathSegment) {
                $itemsData = &$itemsData[$pathSegment];
            }
        }
        if (!isset($itemsData[$configKey])) {
            $itemsData[$configKey] = null;
        }
        if (is_array($itemsData[$configKey]) && is_array($config)) {
            $itemsData[$configKey] = array_merge($itemsData[$configKey], $config);
        } else {
            $itemsData[$configKey] = $config;
        }
    }
981444
protected function readCache( $fileName )
	{
		$file			= new FS_File_Reader( $fileName );
		$content		= $file->readString();
		$this->config	= unserialize( $content );
	}
546896
private function load($env = 'local', $file = 'config')
    {
        $path = BASE_PATH . ($file === '.env' ? '' : '/config');

        // File paths
        $configPath = "{$path}/{$file}.yml";
        $envConfigPath = "{$path}/{$file}_{$env}.yml";

        if (!file_exists($configPath)) {
            throw new \Exception("Config file not found at \"{$configPath}\".");
        }

        $data = file_get_contents($configPath);

        if ($data === false) {
            throw new \Exception("Unable to load configuration from: {$configPath}");
        }

        $yaml = new Parser();

        // Load config
        $config = $yaml->parse($data);
        $this->config = $config ? $config : [];

        // Load environment specific config
        if (file_exists($envConfigPath)) {
            $data = file_get_contents($envConfigPath);

            if ($data) {
                $config = $yaml->parse($data);
                $config = $config ? $config : [];

                // Merge config values
                $this->config = array_merge($this->config, $config);
            }
        }
    }
805958
function load_env()
    {
        if ($this->env_loaded) {
            return;
        }

        $this->env_loaded = true;

        // Add include path for Enigma classes and drivers
        $include_path = $this->home . '/lib' . PATH_SEPARATOR;
        $include_path .= ini_get('include_path');
        set_include_path($include_path);

        // load the Enigma plugin configuration
        $this->load_config();

        // include localization (if wasn't included before)
        $this->add_texts('localization/');
    }
535282
protected function load(string $file): void
	{
		$this->configuration[$file] = $this->loader->load($file, $this->environment);
	}
251340
public function setFileName( $fileName ){
		$this->fileName	= $fileName;
		$this->sheet	= self::load( $fileName );
	}
1123726
public static function load($filename)
    {
        if (!is_readable($filename)) {
            throw new IOError($filename, 'File not found or file is not readable');
        }
        $content = @file_get_contents($filename);
        if ($content === false) {
            self::throwNativeError($filename);
        }
        return $content;
    }