/ \copydoc Erebot::Interfaces::Config::Main::load()
548773
public function load($configData, $source)
    {
        $logger = \Plop\Plop::getInstance();
        $possibleSources = array(
            self::LOAD_FROM_FILE,
            self::LOAD_FROM_STRING,
        );
        if (!in_array($source, $possibleSources, true)) {
            throw new \Erebot\InvalidValueException('Invalid $source');
        }

        if ($source == self::LOAD_FROM_FILE) {
            if (is_string($configData) && $configData != "") {
                if (!strncasecmp(PHP_OS, "Win", 3)) {
                    if (!in_array($configData[0], array("/", "\\")) &&
                        strlen($configData) > 1 && $configData[1] != ":") {
                        $configData = getcwd() . DIRECTORY_SEPARATOR .
                                        $configData;
                    }
                } elseif ($configData[0] != DIRECTORY_SEPARATOR) {
                    $configData = getcwd() . DIRECTORY_SEPARATOR . $configData;
                }
                $file = \Erebot\URI::fromAbsPath($configData, false);
            } elseif (is_object($configData) &&
                $configData instanceof \Erebot\URIInterface) {
                $file = $configData;
            } else {
                throw new \Erebot\InvalidValueException(
                    "Invalid configuration file"
                );
            }
        } elseif (!is_string($configData)) {
            throw new \Erebot\InvalidValueException(
                "Invalid configuration file"
            );
        } else {
            $file = null;
        }

        $mainSchema = dirname(dirname(__DIR__)) .
                        DIRECTORY_SEPARATOR . 'data' .
                        DIRECTORY_SEPARATOR . 'config.rng';
        $mainSchema = file_get_contents($mainSchema);
        $ue         = libxml_use_internal_errors(true);
        $domxml     = new \Erebot\DOM();
        if ($source == self::LOAD_FROM_FILE) {
            $domxml->load((string) $file);
        } else {
            $domxml->loadXML($configData);
        }

        $domxml->xinclude(LIBXML_NOBASEFIX);
        $this->stripXGlobWrappers($domxml);

        $ok         = $domxml->relaxNGValidateSource($mainSchema);
        $errors     = $domxml->getErrors();
        libxml_use_internal_errors($ue);

        if (!$ok || count($errors)) {
            // Some unpredicted error occurred,
            // show some (hopefully) useful information.
            $logger->error(print_r($errors, true));
            throw new \Erebot\InvalidValueException(
                'Errors were found while validating the configuration file'
            );
        }

        $xml = simplexml_import_dom($domxml);
        parent::__construct($this, $xml);

        if (!isset($xml['version'])) {
            $this->version = null;
        } else {
            $this->version  = (string) $xml['version'];
        }

        if (!isset($xml['timezone'])) {
            throw new \Erebot\InvalidValueException('No timezone defined');
        }
        $this->timezone = (string) $xml['timezone'];

        // Set timezone information.
        // This is needed to configure the logging subsystem.
        if (function_exists('date_default_timezone_set')) {
            if (!date_default_timezone_set($this->timezone)) {
                throw \Erebot\InvalidValueException(
                    sprintf(
                        'Invalid timezone: "%s"',
                        $this->timezone
                    )
                );
            }
        }

        $daemonize      = isset($xml['daemon'])
                        ? $this->parseBool((string) $xml['daemon'])
                        : false;
        $userIdentity   = isset($xml['uid']) ? ((string) $xml['uid']) : null;
        $groupIdentity  = isset($xml['gid']) ? ((string) $xml['gid']) : null;
        $pidfile        = isset($xml['pidfile'])
                        ? ((string) $xml['pidfile'])
                        : null;

        if ($daemonize === null) {
            throw new \Erebot\InvalidValueException('Invalid "daemon" value');
        }

        if (!isset($xml['commands-prefix'])) {
            $this->commandsPrefix = '!';
        } else {
            $this->commandsPrefix = (string) $xml['commands-prefix'];
            if (strcspn($this->commandsPrefix, " \r\n\t") !=
                strlen($this->commandsPrefix)) {
                throw new \Erebot\InvalidValueException(
                    'Invalid command prefix'
                );
            }
        }

        $logger->debug(
            $this->coreTranslator->gettext(
                'Loaded configuration data'
            )
        );

        $this->networks = array();
        foreach ($xml->networks->network as $netCfg) {
            /// @TODO use dependency injection instead.
            $newConfig  = new \Erebot\Config\Network($this, $netCfg);
            $this->networks[$newConfig->getName()] = $newConfig;
            unset($newConfig);
        }

        if ($source == self::LOAD_FROM_FILE) {
            $this->configFile   = $configData;
        } else {
            $this->configFile   = null;
        }

        // Default values.
        $this->daemonize        = $daemonize;
        $this->userIdentity     = $userIdentity;
        $this->groupIdentity    = $groupIdentity;
        $this->pidfile          = $pidfile;
    }
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;
        }
    }
1129293
public static function load($files = [], $options = null)
    {
        if (! self::$configurator instanceof ConfiguratorClass) {
            self::$configurator = new ConfiguratorClass($files, $options);
        } else {
            self::$configurator->load($files, $options);
        }
    }
119951
protected function loadConfig()
    {
        $config = new Config(
            \Hail\Facade\Config::get('migrate')
        );

        $this->setConfig($config);
    }
1234862
protected function scanLoadConfig(): void
    {
        /* @var SplFileInfo $directory */
        /* @var SplFileInfo $file */
        foreach (Finder::create()->directories()->depth(1)->name('Config')->in($this->modulePath()) as $directory) {
            foreach (Finder::create()->files()->name('*.php')->in($directory->getPathname()) as $file) {
                $this->mergeConfigFrom($file->getPathname(), Str::snake($directory->getRelativePath()));
            }
        }
    }
231103
public function reload(): void
    {
        $config = [];
        foreach($this->configSources as $src) {
            // If it's a string, then it's a file or directory path
            if (is_string($src)) {
                // If directory, get all config files within it, recursively
                if (is_dir($src)) {
                    $getConfigFiles = function(string $path) use (&$getConfigFiles) {
                        $fragments = [];
                        if (is_dir($path)) {
                            $d = dir($path);
                            while (($f = $d->read()) !== false) {
                                if ($f[0] === '.') {
                                    continue;
                                }
                                if (is_dir("$path/$f")) {
                                    $fragments = array_merge($fragments, $getConfigFiles("$path/$f"));
                                } else {
                                    $fragments[] = "$path/$f";
                                }
                            }
                        }
                        return $fragments;
                    };
                    $fragments = $getConfigFiles($src);
                    sort($fragments);
                    foreach($fragments as $c) {
                        $config = array_replace_recursive($config, $this->parseConfig(file_get_contents($c)));
                    }

                // If it's a file, just merge it's contents over the current config array
                } elseif (is_file($src)) {
                    $config = array_replace_recursive($config, $this->parseConfig(file_get_contents($src)));

                // If it doesn't exist in the filesystem, and it's not optional, throw an exception
                } elseif (array_search($src, $this->optional) === false) {
                    throw (new MissingConfigFileException("Required config file or directory `$src` is missing."))
                        ->setMissingPath($src);
                }

            // If the source is an array, just merge it in
            } elseif (is_array($src)) {
                $config = array_replace_recursive($config, $src);
            }
        }
        $this->config = $config;
    }
166425
private function loadingConfig()
    {
        if ($_SERVER['HTTP_HOST'] == SERVER_DEVELOP) {
            if (!is_file(SYSTEM_ROOT . '/config/config.local.php'))
                @copy(SYSTEM_ROOT . '/config/config.sample.php', SYSTEM_ROOT . '/config/config.local.php');
            require_once('config/config.local.php');
        } else {
            if (!is_file(SYSTEM_ROOT . '/config/config.php'))
                @copy(SYSTEM_ROOT . '/config/config.sample.php', SYSTEM_ROOT . '/config/config.php');
            require_once('config/config.php');
        }
    }
203443
public static function load()
	{
		static::start(Config::get('session.driver'));

		static::$instance->load(Cookie::get(Config::get('session.cookie')));
	}
241456
function load($dsn) {
		$fw=Base::instance();
		if ($dsn=trim($dsn)) {
			if (preg_match('/^redis=(.+)/',$dsn,$parts) &&
				extension_loaded('redis')) {
				$port=6379;
				$parts=explode(':',$parts[1],2);
				if (count($parts)>1)
					list($host,$port)=$parts;
				else
					$host=$parts[0];
				$this->ref=new Redis;
				if(!$this->ref->connect($host,$port,2))
					$this->ref=NULL;
			}
			elseif (preg_match('/^memcache=(.+)/',$dsn,$parts) &&
				extension_loaded('memcache'))
				foreach ($fw->split($parts[1]) as $server) {
					$port=11211;
					$parts=explode(':',$server,2);
					if (count($parts)>1)
						list($host,$port)=$parts;
					else
						$host=$parts[0];
					if (empty($this->ref))
						$this->ref=@memcache_connect($host,$port)?:NULL;
					else
						memcache_add_server($this->ref,$host,$port);
				}
			if (empty($this->ref) && !preg_match('/^folder\h*=/',$dsn))
				$dsn=($grep=preg_grep('/^(apc|wincache|xcache)/',
					array_map('strtolower',get_loaded_extensions())))?
						// Auto-detect
						current($grep):
						// Use filesystem as fallback
						('folder='.$fw->get('TEMP').'cache/');
			if (preg_match('/^folder\h*=\h*(.+)/',$dsn,$parts) &&
				!is_dir($parts[1]))
				mkdir($parts[1],Base::MODE,TRUE);
		}
		$this->prefix=$fw->hash($_SERVER['SERVER_NAME'].$fw->get('BASE'));
		return $this->dsn=$dsn;
	}
321935
private function load_host_config()
    {
        if (empty($this->prop['include_host_config'])) {
            return;
        }

        foreach (array('HTTP_HOST', 'SERVER_NAME', 'SERVER_ADDR') as $key) {
            $fname = null;
            $name  = $_SERVER[$key];

            if (!$name) {
                continue;
            }

            if (is_array($this->prop['include_host_config'])) {
                $fname = $this->prop['include_host_config'][$name];
            }
            else {
                $fname = preg_replace('/[^a-z0-9\.\-_]/i', '', $name) . '.inc.php';
            }

            if ($fname && $this->load_from_file($fname)) {
                return;
            }
        }
    }
1061100
protected function load()
    {
        $data = file_get_contents($this->filename);
        // Ok, here comes the dirty work.
        // We take everything at the beginning of the file until the closing of the first doc comment.
        preg_match('#^(.+\*/)#sU', $data, $matches);

        if ($matches && count($matches[0])) {
            $this->head = $matches[0];
            if (preg_match(
                '#https://www.transifex.com/projects/p/(.*)/language/(.*)/#',
                $this->head,
                $match,
                PREG_OFFSET_CAPTURE
            )) {
                $this->transifexProject = $match[1][0][0];
                $this->language         = $match[2][0][0];
            }
        } else {
            $this->head = $this->getDefaultHead();
        }
        $this->langstrings = array();

        $parser = new Parser($this);
        $parser->setContent($data);
        $parser->parse();
    }
693023
private function Load()
	{
		$sql = "show tables";
		$rs = $this->Server->Connection->Select($sql);
		
		// first pass load all the tables.  this will initialize each object.  we have to
		// do this first so that we can correctly determine and store "Set" information
		while ($row = $this->Server->Connection->Next($rs))
		{
			$this->Tables[$row["Tables_in_" . $this->Name]] = new DBTable($this,$row);
		}
		
		// now load all the keys and constraints for each table
		foreach ($this->Tables as $table)
		{
			$table->LoadKeys();
		}

		$this->Server->Connection->Release($rs);
		
		$sql = "show table status from `" . $this->Name . "`";
		$rs2 = $this->Server->Connection->Select($sql);
		
		// load the extra data
		while ($row = $this->Server->Connection->Next($rs2))
		{
			$this->Tables[$row["Name"]]->Engine = $row["Engine"]; 
			$this->Tables[$row["Name"]]->Comment = $row["Comment"];
		}
		$this->Server->Connection->Release($rs2);
	}
74171
public static function load($input)
    {
        $config = '';
        if (isset($input['config'])) {
            // set the location of the configuration file
            $config = $input['config'];
        }
        $instance = new self($config);
        $instance->loadUserInput($input);
        $instance->go();
        return $instance;
    }
448475
protected function loadCopy()
    {
        $copy = @file_get_contents($this->path . '/README.md');

        if ($copy) {
            $this->copy = Markdown::defaultTransform($copy);
        } else {
            $this->copy = false;
        }
    }
100526
private function loadConfig()
    {
        // Look for .terra.yml
        $fs = new FileSystem();
        if ($fs->exists($this->getSourcePath().'/.terra.yml')) {
            try {
                // Process any string replacements.
                $environment_config_string = file_get_contents($this->getSourcePath().'/.terra.yml');
                $this->config = Yaml::parse(strtr($environment_config_string, array(
                  '{{alias}}' => $this->getDrushAlias(),
                  '{{uri}}' => $this->getUrl(),
                  '{{environment}}' => $this->environment->name,
                  '{{apps}}' => $this->app->name,
                )));
            }
            catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
                $this->config = null;
            }
        } else {
            $this->config = null;
        }
    }
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;
    }
608435
public function loadConfig()
    {
        $fileName = File::path(dirname($this->getPath()), 'config/config.php');
        if(is_file($fileName))
        {
            Config::addConfig('@' . $this->moduleName, include $fileName);
        }
    }