Load the plugin.

@param string $configPath

@return PluginManager
547499
public function load(string $configPath): PluginManager
    {
        $this->setDirectory();
        $this->setConstants();
        $this->setPrefix();
        $this->loadPluginConfiguration($configPath);
        $this->setPluginAutoloading();

        return $this;
    }
592146
protected function filesIn($configPath)
    {
        $files = [];

        foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
            $group = basename($file->getRealPath(), '.php');
            $files[$group] = $file->getRealPath();
        }

        return $files;
    }
1172377
public function loadFrom(string $path): void
    {
        $this->path = $path;

        if (is_file($path)) {
            $this->data = require $path;

            if (!is_array($this->data)) {
                throw new ConfigException("Config loaded from path={$path} is not an array");
            }

            $this->loadedAt = time();
        } else {
            throw new ConfigException('Unable to load config from path=' . $path);
        }
    }
677969
public static function loadConfigFiles($configPath = false)
    {
        if(!is_dir($configPath)) {
            throw new \Exception("Config directory {$configPath} not found!");
        }

        $filesToBeLoaded = scandir($configPath);
        foreach($filesToBeLoaded as $_file) {
            if(preg_match('/.*\.php/',$_file)) {
                include_once $configPath.DIRECTORY_SEPARATOR.$_file;
            }
        }

        return true;
    }
251861
function loadConfigFile(configPath) {
	logger.debug('Loading configuration file at:', configPath);

	function loadConfig() {
		return fs.readFileSync(configPath, { encoding: 'utf8' });
	}

	function parseConfig(content, extension) {
		switch (extension) {
		case '.js':
			return require(configPath);

		case '.yaml':
			return jsYaml.safeLoad(content, { filename: configPath });

		case '.json':
			try {
				return JSON.parse(content);
			} catch (error) {
				// Try to provide more specific syntax errors
				lintJson(content);

				// If no syntax errors are found, throw a generic error
				throw new Error('There was a problem loading a configuration file: ' + configPath);
			}

		case '.json5':
			return JSON5.parse(content);

		default:
			throw new Error(`Configuration file is an unsupported type [${supportedTypes.join(', ')}]: ` + configPath);
		}
	}

	var extension = path.extname(configPath);
	var content;

	try {
		content = loadConfig();
	} catch (error) {
		throw new ConfigurationError('Failed to read configuration file', configPath, error);
	}

	try {
		return parseConfig(content, extension);
	} catch (error) {
		throw new ConfigurationError('Failed to parse configuration file', configPath, error);
	}
}
945326
public function loadPlugin($pluginName)
    {
        if (isset($this->loadedPlugins[$pluginName])) {
            return $this->loadedPlugins[$pluginName];
        }
        $newPlugin = $this->makePluginClass($pluginName);

        $this->addLoadedPlugin($pluginName, $newPlugin);
        return $newPlugin;
    }
421590
public function loadConfig($path)
    {
        //add extension to the config file
        $path = sprintf("%s.%s", $path, $this->config_file_extension);

        //lets try loading the config file data
        return $this->loader->load($path);
    }
148144
public function localConfigPath(?string $localConfigPath = null) {
        if ($localConfigPath != null) {
            $this->localConfigPath = $localConfigPath;
        }
        else {
            if (!isset($this->localConfigPath)) {
                $this->localConfigPath = $this->basePath() . DIRECTORY_SEPARATOR . "config.local";
            }
        }
        return $this->localConfigPath;
    }
184698
public static function loadFromPath($path)
	{
		// on test do not load plugins
		if(self::isUnableToRunPlugins())
		{
			return;
		}

		if (!file_exists($path))
		{
			throw new InvalidArgumentException("The path [{$path}] doesn't exist to load plugins.");
		}

		$plugins = require $path;

		foreach ($plugins as $plugin)
		{
			if (array_key_exists($plugin, self::$lookup))
			{
				$plugin = __DIR__ . DS . self::$lookup[$plugin];
			}

			if (file_exists($plugin))
			{
				require_once $plugin;
			}
		}

	}
642232
private static JNRPEConfiguration loadConfiguration(final String configurationFilePath) throws ConfigurationException {
        File confFile = new File(configurationFilePath);

        if (!confFile.exists() || !confFile.canRead()) {
            throw new ConfigurationException("Cannot access config file : " + configurationFilePath);
        }

        return JNRPEConfigurationFactory.createConfiguration(configurationFilePath);

    }
595876
function loadConfig(path) {
    var glob = require('glob');
    var object = {};
    var key;

    glob.sync('*', {cwd: path}).forEach(function(option) {
      key = option.replace(/\.js$/,'');
      object[key] = require(path + option);
    });

    return object;
  }
1133034
public static function init($configPath = null)
    {
        if (!isset(self::$instances[$configPath])) {
            self::$instances[$configPath] = new IDS_Init($configPath);
        }

        return self::$instances[$configPath];
    }
1284625
protected function getConfigurationFilesInPath($configPath)
    {
        $files = [];

        if (! is_dir($configPath)) {
            return $files;
        }

        foreach (Finder::create()->files()->name('*.php')->depth(0)->in($configPath) as $file) {
            $files[$file->getBasename('.php')] = $file->getRealPath();
        }

        ksort($files, SORT_NATURAL);

        return $files;
    }
588043
public function loadFile($path) {
        $config = null;

        try {
            $config = require $path;
        } catch (Exception $ex) {}

        if ( ! is_array($config)) {
            throw new InvalidConfigFormatException(
                s('ArrayConfigDriver expects config at path %s to be of format array[key => value].', $path)
            );
        }

        return $config;
    }
727086
public function loadConfig($configPath)
    {
        if ( !$configPath ) {
            throw new \InvalidArgumentException('Config path cannot be empty');
        }

        if ( !is_dir($configPath) ) {
            if ( FALSE === strstr($configPath, '.php') ) {
                return;
            }
            $parsed = include $configPath;
            if ( !is_array($parsed) || !$parsed ) {
                return;
            }
            $parsed          = $parsed;
            $this->container = ArrayUtils::merge(
                $this->container,
                $parsed
            );

            return;
        }

        $objects = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($configPath),
            \RecursiveIteratorIterator::SELF_FIRST
        );


        $localObjects = [];

        /**
         * @var string       $name
         * @var \SplFileInfo $object
         */
        foreach ($objects as $object) {
            if ( $object->isDir() ) {
                continue;
            }
            if ( 'php' !== $object->getExtension() ) {
                continue;
            }

            if ( FALSE !== strstr($object->getFilename(), 'local.php') ) {
                $localObjects[ ] = $object;
                continue;
            }

            $parsed = include $object->getRealPath();
            if ( !$parsed || !is_array($parsed) ) {
                continue;
            }

            $parsed          = $parsed;
            $this->container = ArrayUtils::merge(
                $this->container,
                $parsed
            );
        }

        /**
         * @var string       $name
         * @var \SplFileInfo $object
         */
        foreach ($localObjects as $object) {
            $parsed = include $object->getRealPath();
            if ( !$parsed || !is_array($parsed) ) {
                continue;
            }

            $parsed          = $parsed;
            $this->container = ArrayUtils::merge(
                $this->container,
                $parsed
            );
        }

        return $this;
    }
745821
public function setupServiceManager($configPath)
    {
        try {
            $this->getServiceManager();
        } catch (InvalidServiceManagerException $e) {
            if (! \helpers_File::emptyDirectory($configPath, true)) {
                throw new \common_exception_Error('Unable to empty ' . $configPath . ' folder.');
            }
            $driver = new ServiceConfigDriver();
            $configService = $driver->connect('config', array(
                'dir' => $configPath,
                'humanReadable' => true
            ));

            $this->setServiceManager(new ServiceManager($configService));
        }

        return $this->getServiceManager();
    }
321941
public function create(string $rootPath, string $configFilePath): ConfigBagInterface
    {
        $file = $this->resolvePath($rootPath, $configFilePath);

        $envs = $this->parseMainFile($file);
        $envs = $this->mergeExternalFiles($file, $envs);

        return ConfigBag::root(
            $envs,
            $this->getEnvironment(),
            $rootPath
        );
    }