Loads environment variables.
@param string $filename Path to the .env file.
6557
public static function load(string $filename) {
		if(class_exists(Dotenv::class)) {
			$dotenv = new Dotenv($filename);
			$dotenv->load();
		}
	}
594261
private function addEnvironmentVariables($value)
    {
        if (is_array($value)) {
            $value = array_map(array($this, __METHOD__), $value);
        } elseif (is_string($value)) {
            $value = strtr($value, $this->environmentVariables);
        }

        return $value;
    }
986184
protected function loadYamlFile( $fileName )
	{
		$array	= FS_File_YAML_Reader::load( $fileName );
		foreach( $array as $sectionName => $sectionData )
			foreach( $sectionData as $key => $value )
				$this->pairs[$sectionName.".".$key]	= $value;
	}
320808
public static function loadFile($filename)
    {
        if (class_exists(\PHPUnit\Util\Fileloader::class)) {
            // PHPUnit 6.x
            \PHPUnit\Util\Fileloader::checkAndLoad($filename);
        } else {
            // PHPUnit 7.x+
            \PHPUnit\Util\FileLoader::checkAndLoad($filename);
        }
    }
261859
public static function putEnv($string)
    {
        // Parse name-value pairs
        $envVars = parse_ini_string($string) ?: [];
        foreach ($envVars as $name => $value) {
            self::setEnv($name, $value);
        }
    }
378988
private function loadEnvironment($env) {
    $this->exec = array_merge_recursive_distinct($this->exec, $this->environments[$env]);
    $this->loadedEnvs[$env] = $this->exec['filename'];
    unset($this->exec['filename']);
  }
430693
protected function loadTokenFromFile($filename)
    {
        if (strpos($filename, '/') !== 0 && strpos($filename, '\\') !== 0) {
            $filename = $this->config->getUserConfigDir() . '/' . $filename;
        }

        $content = file_get_contents($filename);
        if ($content === false) {
            throw new \RuntimeException('Failed to read file: ' . $filename);
        }

        return trim($content);
    }
251340
public function setFileName( $fileName ){
		$this->fileName	= $fileName;
		$this->sheet	= self::load( $fileName );
	}
484901
protected function loadFile($filename)
    {
        if (isset($this->aliases[$filename])) {
            $filename = $this->aliases[$filename];
        }

        switch (pathinfo($filename, PATHINFO_EXTENSION)) {
            case 'js':
            case 'json':
                $level = error_reporting(0);
                $json = file_get_contents($filename);
                error_reporting($level);

                if ($json === false) {
                    $err = error_get_last();
                    throw new InvalidArgumentException("Unable to open {$filename}: " . $err['message']);
                }

                $config = json_decode($json, true);
                // Throw an exception if there was an error loading the file
                if ($error = json_last_error()) {
                    $message = isset(self::$jsonErrors[$error]) ? self::$jsonErrors[$error] : 'Unknown error';
                    throw new RuntimeException("Error loading JSON data from {$filename}: ({$error}) - {$message}");
                }
                break;
            case 'php':
                if (!is_readable($filename)) {
                    throw new InvalidArgumentException("Unable to open {$filename} for reading");
                }
                $config = require $filename;
                if (!is_array($config)) {
                    throw new InvalidArgumentException('PHP files must return an array of configuration data');
                }
                break;
            default:
                throw new InvalidArgumentException('Unknown file extension: ' . $filename);
        }

        // Keep track of this file being loaded to prevent infinite recursion
        $this->loadedFiles[$filename] = true;

        // Merge include files into the configuration array
        $this->mergeIncludes($config, dirname($filename));

        return $config;
    }
189585
public static function fromFile($fileName) {
        if (!file_exists($fileName))
            throw new SettingsException("file $fileName does not exist");
        return static::fromString(file_get_contents($fileName), dirname($fileName));
    }
15658
public function load(string $filename)
    {
        if (!file_exists($filename)) {
            Throw new AppException(sprintf('Languagefile "%s" does not exist.'), $filename);
        }

        $loaded = include $filename;

        if ($loaded) {
            $array = new Flatten($loaded);
            $array->setPreserveFlaggedArraysFlag(true);
            $this->strings = array_replace($this->strings, $array->flatten());
        }
    }
1158804
public function loadFile($filename) {
		$this->filename = $filename;


		// If a cache directory was specified,
        // try to load from it
		if ($this->cachePath) {
		    if (! $this->templatesRoot) {
		        $this->templatesRoot = dirname($filename);
            }
		    $cacheFile = $this->makeCacheFilename($this->cachePath, $this->templatesRoot, $this->filename);
            if ( file_exists($cacheFile)
                 && (! file_exists($this->filename) || (filemtime($this->filename) < filemtime($cacheFile)) )
            ) {
                $this->loadFromSerialized(file_get_contents($cacheFile));
                return;
            }
        }

		if(file_exists($filename)) {
			$this->source = file_get_contents($filename);
		} else {
			$message = "File not found: $filename";
			throw new FileNotFoundException($message, $filename);
		}
	}
108697
protected function loadFile($name, $filename)
    {
        $file = CompiledYamlFile::instance($filename);
        if (preg_match('|languages\.yaml$|', $filename)) {
            $this->object->mergeRecursive((array) $file->content());
        } else {
            $this->object->mergeRecursive([$name => $file->content()]);
        }
        $file->free();
    }
88986
protected function load($filename)
    {
        $success = false;

        if (file_exists($filename)) {
            /** @noinspection PhpIncludeInspection */
            require $filename;
            $success = true;
        }

        return $success;
    }
335781
protected static function loadFileInMemory($fileName)
  {
    if (!preg_match('/\.ini$/i', $fileName)) {
      $fileName .= '.ini';
    }
    $found = 0;
    foreach (self::$storages as $priority => $substorages) {
      foreach ($substorages as $storage) {
        $data = parse_ini_file(sprintf('%s/%s/%s', $storage, self::$languageCode, $fileName));
        if ($data) {
          self::$translations = array_merge(self::$translations, $data);
          $found++;
        }
      }
    }
    return $found != 0;
  }
609329
protected function loadXmlFile( $fileName )
	{
		$root	= XML_ElementReader::readFile( $fileName );											//  get root element of XML file
		$this->pairs	= array();
		foreach( $root as $sectionNode )															//  iterate sections
		{
			$sectionName	= $sectionNode->getAttribute( 'name' );									//  get section name
			$this->loadXmlSection( $sectionNode, $sectionName );									//  read section
		}
		ksort( $this->pairs );																		//  sort resulting pairs by key
	}
560523
protected function loadEnvFile($file) {
    list($name, ,) = explode('.', $file->name);
    $this->environments[$name] = $this->extractEnv($file->filename);
    $this->environments[$name]['filename'] = $this->parseFilename($file->filename);
  }