Load a config file

@param string $file The config file without the extension
@return
12917
public function load($file)
    {
        $file_name = $this->_config_path.$file.'.php';

        // load the file, but only once
        if (is_file($file_name) and ! array_key_exists($file, $this->_loaded)) {
            // the config file values are secondary to the config values that have already been set
            $this->_config = array_merge(require $file_name, $this->_config);

            $this->_loaded[$file] = true;

            return true;
        } elseif (! is_file($file_name)) {
            throw new \QuickCacheException('The config file "'.$file.'" does not exist');
        }
    }
957936
public function load($file)
    {
        $resource = new ZipFileResource($file);

        $package = $resource->getXML('META-INF/container.xml');

        if (!$opfFile = (string) $package->rootfiles->rootfile['full-path']) {
            $ns = $package->getNamespaces();
            foreach ($ns as $key => $value) {
                $package->registerXPathNamespace($key, $value);
                $items = $package->xpath('//'. $key .':rootfile/@full-path');
                $opfFile = (string) $items[0]['full-path'];
            }
        }

        $data = $resource->get($opfFile);

        // all files referenced in the OPF are relative to it's directory
        if ('.' !== $dir = dirname($opfFile)) {
            $resource->setDirectory($dir);
        }

        $opfResource = new OpfResource($data, $resource);
        $package = $opfResource->bind();
        
        $package->opfDirectory = dirname($opfFile);
        
        if ($package->navigation->src->href) {
            $ncx = $resource->get($package->navigation->src->href);
            $ncxResource = new NcxResource($ncx);
            $package = $ncxResource->bind($package);
        }
        
        return $package;
    }
535959
public static function load($file='config', $name=null, $range=null)
    {
        // avoid repeated load
        $range = $range ?: static::$range;
        if (!isset(static::$loadedRanges[$range][$file])) {
            static::$loadedRanges[$range][$file] = 1;
        } else {
            return static::get($name ?: (($loadname = basename($file))=='config' ? null : $loadname), $range);
        }
        
        if (is_file($file)) {
            $type = pathinfo($file, PATHINFO_EXTENSION);
            if ('php' == $type) {
                $value = static::_loadFile($file);
            } elseif ('yaml' == $type && function_exists('yaml_parse_file')) {
                $value = yaml_parse_file($file);
            } else {
                $value = null;
            }
            if (!$name) {
                $name = pathinfo($file, PATHINFO_FILENAME);
                if ($name === 'config') {
                    $name = null;
                }
            }
            return self::set($name, $value, $range);
        } else {
            if (!$range || $range == 'common') {
                $basePath = static::getCommonPath();
                $range = null;
            } else {
                if (!file_exists($range)) {
                    $basePath = Ioc::app()->getBasePath() . trim($range, '/');
                } else {
                    $basePath = rtrim($range, '/') . '/';
                }
                $range = explode('.', basename($basePath))[0];
                if ($range == basename(static::getCommonPath()) || $range == basename(Ioc::app()->getBasePath())) {
                    $range = null;
                }
            }
            
            if (!$name) {
                $name = pathinfo($file, PATHINFO_FILENAME);
                if ($name === 'config') {
                    $name = null;
                }
            }
            
            $res = null;
            
            // 1. <app>/config/file
            $tmp = $basePath . 'config/' . $file;
            $tmpfile = $tmp . '.php';
            if (!file_exists($tmpfile)) {
                $tmpfile = $tmp . static::$encryptExt;
            }
            if (file_exists($tmpfile)) {
                $res = self::set($name, static::_loadFile($tmpfile), $range);
            }
            
            // 2. <app>/config-<env>/file
            if ($env = static::$env) {
                $tmp = $basePath . 'config-' . $env . '/' . $file;
                $tmpfile = $tmp . '.php';
                if (!file_exists($tmpfile)) {
                    $tmpfile = $tmp . static::$encryptExt;
                }
                if (file_exists($tmpfile)) {
                    $res = self::set($name, static::_loadFile($tmpfile), $range);
                }
            }
            
            return $res;
        }
    }
1258586
private function loadFile ($file)
	{
		if (!isset ($this->files[$file]))
		{
			$filename = $this->folder . $file . '.php';

			// First load these
			if (file_exists ($filename))
			{
				$this->files[$file] = include ($filename);
			}

			// Now overload with environment values
			if (isset ($this->environment))
			{
				$filename = $this->folder . $this->environment . '/' . $file . '.php';
				if (file_exists ($filename))
				{
					$this->merge ($file, include ($filename));
				}
			}

		}
	}
266955
public function loadFile( $file ) {

		if ( empty( $this->files ) )
			$this->files = $this->readDirRecursive(
				$this->base_dir,
				'*' . $this->extension
			);

		if ( ! in_array( $file, $this->files ) )
			return FALSE;

		require_once $file;

		return TRUE;
	}
295529
public function loadFile($file = null)
    {
        if (null === $file) {
            $file = $this->getDefaultPath();
        }

        $json = $this->json->decodeFile($file);

        if (isset($json->import)) {
            if (!Path::isAbsolute($json->import)) {
                $json->import = Path::join(
                    array(
                        dirname($file),
                        $json->import
                    )
                );
            }

            $json = (object) array_merge(
                (array) $this->json->decodeFile($json->import),
                (array) $json
            );
        }

        $this->json->validate(
            $this->json->decodeFile(BOX_SCHEMA_FILE),
            $json
        );

        return new Configuration($file, $json);
    }
1039792
protected function loadFile($file)
    {
        if (!class_exists('Symfony\Component\Yaml\Parser')) {
            throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.');
        }

        if (!stream_is_local($file)) {
            throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file));
        }

        if (!file_exists($file)) {
            throw new InvalidArgumentException(sprintf('The file "%s" does not exist.', $file));
        }

        if (null === $this->yamlParser) {
            $this->yamlParser = new YamlParser();
        }

        try {
            $configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
        } catch (ParseException $e) {
            throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e);
        }

        return $this->validate($configuration, $file);
    }
355005
protected function loadInstanceFromFile($file) {
        if(file_exists($file)) {
            $arguments = $this->getConfiguration() [ AbstractFileConfiguration::SERVICE_INIT_ARGUMENTS ] ?? NULL;

            $object = _context_less_require($file, $arguments, $this->serviceManager);
            if(is_object($object)) {
                $this->instance = $object;
                if(method_exists($object, 'setConfiguration') && ($cfg = $this->getConfiguration()[AbstractFileConfiguration::SERVICE_INIT_CONFIGURATION] ?? NULL))
                    $object->setConfiguration($cfg);
            }
            else {
                $e= new InvalidServiceException("Executation of file $file did not return an object");
                $e->setServiceName($this->serviceName);
                $e->setServiceObject($object);
                throw $e;
            }
        } else {
            $e = new FileNotFoundException("File $file does not exist");
            $e->setServiceName($this->serviceName);
            $e->setFilename($file);
            throw $e;
        }
    }
86423
public function load($file)
    {
        if (file_exists($file)) {
            $this->feed = ZendReader::importFile($file);
        } else {
            $this->feed = ZendReader::import($file);
        }

        return $this;
    }
885322
protected function loadFile($file)
    {
        $requiredFiles = $this->getRequiredFiles($file);
        $this->values[$file] = true;

        foreach ($requiredFiles as $fileToRequire) {
            $overrideConfig = require $fileToRequire['path'];
            $this->config->addConfig([$file => $overrideConfig], $fileToRequire['environment']);
        }
    }
498711
public function load($file = '@config/app.php')
    {
        /** @noinspection PhpIncludeInspection */
        $data = require $this->alias->resolve($file);

        foreach ((array)$data as $field => $value) {
            if (!property_exists($this, $field)) {
                throw new NotSupportedException(['`:item` item is not allowed: it must be a public property of `configure` component', 'item' => $field]);
            }

            $this->$field = $value;
        }

        return $this;
    }
1246808
public static function loadFromFile($file)
    {
        if (file_exists($file) === false) {
            throw new FileNotFoundException($file);
        }

        if (preg_match('/(\.toml)$/', $file) !== 1) {
            throw new NotSupportFileTypeException($file);
        }

        $values = Toml::parse($file);
        $values = (is_array($values) === true) ? $values : [];

        $config = new Config($values);
        $config->merge(new Config([
            self::CONFIG_FILE_KEY => $file,
            self::CONFIG_DIRECTORY_KEY => dirname(realpath($file)) . DIRECTORY_SEPARATOR
        ]));

        return new BuilderConfiguration($config);
    }
1182878
public function load_from_file($file)
    {
        $success = false;

        foreach ($this->resolve_paths($file) as $fpath) {
            if ($fpath && is_file($fpath) && is_readable($fpath)) {
                // use output buffering, we don't need any output here
                ob_start();
                include($fpath);
                ob_end_clean();

                if (is_array($config)) {
                    $this->merge($config);
                    $success = true;
                }
                // deprecated name of config variable
                if (is_array($rcmail_config)) {
                    $this->merge($rcmail_config);
                    $success = true;
                }
            }
        }

        return $success;
    }
894850
function load(string $file = null)
    {
        if ($file == null) {
            $file = static::$configFile;
        }
        if (!file_exists($file)) {
            return false;
        }

        $a = json_decode(file_get_contents($file));

        if (isset($a->css)) {
            $this->css = $a->css;
        }

        if (isset($a->js)) {
            $this->js = $a->js;
        }
        
        if (isset($a->jss)) {
            $this->jss = $a->jss;
        }
        
        return true;
    }
191212
public function load($file)
    {
        if (!is_file($file)) {
            if (!$found = $this->findFile($file)) {
                $paths = array_values(iterator_to_array(clone $this->paths));

                $paths = implode(" / ", $paths);

                throw new \RuntimeException(sprintf('Language file: %s not found. Paths in queue: %s', $file, $paths));
            }
        } else {
            $found = $file;
        }

        return file_get_contents($found);
    }
383031
protected function load_file($file)
	{
		$contents = $this->parse_vars(file_get_contents($file));
		return parse_ini_string($contents, true);
	}
32697
public function load($file)
    {
        $dir = $this->getDir();

        if (!$this->filesystem->exists($dir . $file)) {
            throw new NotFoundException('File not found.');
        }

        return file_get_contents($dir . $file);
    }