Load configuration for a given command.
Loading happens only once, after that cached info is returned

@param string $file  Config file name

@return array Array of loaded config data
553609
private function load($file)
    {
        if (!isset($this->commands[$file])) {
            $this->commands[$file] = Yaml::parse($file);
        }
        return $this->commands[$file];
    }
1287552
public function loadFile($file)
    {
        $data = json_decode(file_get_contents($file), true);
        if (json_last_error() != JSON_ERROR_NONE) {
            throw new LoaderException(sprintf("Could not load the JSON file '%s': %s", $file, json_last_error_msg()));
        }
        return $data;
    }
873456
protected function _loadConfig($file) {
        $suffix = pathinfo($file, PATHINFO_EXTENSION);
        $suffix = ($suffix === 'dist') ?
                    pathinfo(basename($file, ".$suffix"), PATHINFO_EXTENSION) : $suffix;
        if ($suffix == 'ini') {
            $config = Garp_Config_Ini::getCached($file, $this->getEnvironment())->toArray();
        } else {
            $config = parent::_loadConfig($file);
        }
        return $config;
    }
119193
public function load($file)
    {
        $schema = array();

        $path     = $this->locator->locate($file);
        $xml      = $this->parseFile($path);
        $document = $xml->documentElement;

        /** @var \DOMElement $setting */
        $prefix = $document->hasAttribute('prefix') ? $document->getAttribute('prefix') . '.' : '';

        foreach ($document->getElementsByTagName('parameter') as $node) {
            $this->parseParameter($node, $schema, $prefix);
        }

        return $schema;
    }
720162
public function loadFile($file)
    {
        if (!file_exists($file)) {
            throw new LoaderException("Requested YAML file '{$file}' doesn't exist");
        }

        $contents = file_get_contents($file);

        if ($this->useSymfony) {
            try {
                // Apparently parser keeps references to the things it parses? As such, we want to create a new parser
                // each time (uch)
                $parser = new Parser();
                return $parser->parse($contents);
            } catch (ParseException $e) {
                throw new LoaderException("Could not load the YAML file '{$file}': ".$e->getMessage());
            }
        }

        $data = yaml_parse($contents);
        if (!is_array($data)) {
            throw new LoaderException("Requested YAML file '{$file}' does not parse to an array");
        }

        return $data;
    }
44835
public function loadFile($file)
    {
        if (is_array($file)) {
            return collect($file)->mapWithKeys(function ($subFile, $key) {
                return [$key => $this->loadFile($subFile)];
            })->toArray();
        }

        return $this->parser->parseFile($file);
    }
209695
public function loadFile($file)
    {
        if (!file_exists($file)) {
            throw new LoaderException("Requested file '{$file}' doesn't exist");
        }

        $data = include($file);

        if (!is_array($data)) {
            throw new LoaderException("Requested file '{$file}' is expected to return an array");
        }

        return $data;
    }
1312908
public static function load($file)
    {
        if (file_exists($file)) {
            $env = \M1\Env\Parser::parse(file_get_contents($file));
            foreach ($env as $key => $value) {
                putenv("{$key}={$value}");
            }
        }
    }
250001
protected function loadDefinitionFromFile(/*# string */ $file)/*# : array */
    {
        // check first
        $this->checkFileExistence($file);

        // get definition type and loader class base on suffix
        list($type, $class) = $this->getFileTypeClass($file);

        // load into an array
        $data = $class::loadFromFile($file);

        // associate with definition type
        return $type ? [$type => $data] : $data;
    }
266056
private function getFileContents($file)
    {
        if (!isset($this->filesContent[$file])) {
            $this->filesContent[$file] = file_exists($file) ? file($file) : [];
        }

        return $this->filesContent[$file];
    }
1153546
public function load($file, $namespace = '', $parser = null, $env = null)
    {
        $config = [];

        $this->currentFile = $file;

        //~ Check in cache
        if (is_object($this->cache)) {
            $config = $this->cache->get('Eureka.Component.Config.Test.' . $env . '.' . md5($file) . '.cache');
        }

        //~ If not in cache or cache object not defined
        if (empty($config)) {

            if (!file_exists($file)) {
                throw new \Exception('Configuration file does not exists !');
            }

            $config = $parser->load($file);

            if ($env !== null) {
                $configTmp = [];

                //~ Firstable, pick section 'all' from config if section exists.
                if (isset($config['all']) && is_array($config['all'])) {
                    $configTmp = $config['all'];
                }

                //~ Secondly, merge recursively with section corresponding with environment if section exists.
                if (isset($config[$env]) && is_array($config[$env])) {
                    $configTmp = array_replace_recursive($configTmp, $config[$env]);
                }

                //~ Set merged configurations into main array.
                $config = $configTmp;
            }

            if (is_object($this->cache)) {
                $this->cache->set('Eureka.Component.Config.Test.' . $env . '.' . md5($file) . '.cache', $config);
            }
        }

        $this->add($namespace, $config);

        $this->currentFile = '';

        return $this;
    }
1159088
protected function load_array_from_file( $file, $base_directory = null ) {
		// Grab our file's basename
		$file_base = basename( $file, '.php' );

		// Define our file path
		$file_path = $base_directory ? $base_directory . $file : $file;

		// Include the file
		require( $file_path );

		// Set the file's returned configuration in a namespaced key
		$array = array( $file_base => ${$this->callback_name}() );

		// Garbage collect
		unset( ${$this->callback_name} );

		return $array;
	}
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;
        }
    }
299695
public static function loadKeyFromCertificateFile($file)
    {
        Assertion::true(file_exists($file), sprintf('File "%s" does not exist.', $file));
        $content = file_get_contents($file);

        return self::loadKeyFromCertificate($content);
    }
356415
public function load(string $file)
    {
        $file = $this->sanitizeFileName($file);
        if (empty($this->loaded)
            && !empty($this->beforeFirstTimeLoadCallBack)
            && $this->isValid()
        ) {
            $callback = $this->beforeFirstTimeLoadCallBack;
            $callback($this);
            $this->beforeFirstTimeLoadCallBack = false;
        }

        $this->loaded[$file] = isset($this->loaded[$file])
            ? $this->loaded[$file]+1
            : 1;
        return RequireBinding::with(($this->getThemePath() . $file), $this);
    }
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);
    }
628310
private function getRealCommandName($file)
    {
        $iter = CommandLine\Commands::getInstance();
        $commands = array();
        foreach ($iter as $name => $data) {
            $commands[$name] = $data;
        }
        ksort($commands);

        if (!file_exists($file)) {
            foreach ($commands as $command) {
                if (is_array($command["command"]["aliases"]) && in_array($file, $command["command"]["aliases"])) {
                    return $command["command"]["name"];
                }
            }
        }

        return $file;
    }