/** * __construct * @param string|string[] $config fully qualified name of configuration file * or configuration array * @throws Exception */ private final function __construct($config) { if (!class_exists('XoopsLoad', false)) { include __DIR__ . '/xoopsload.php'; } if (is_string($config)) { $yamlString = file_get_contents($config); if ($yamlString === false) { throw new \Exception('XoopsBaseConfig failed to load configuration.'); } $loaderPath = $this->extractLibPath($yamlString) . '/vendor/autoload.php'; if (file_exists($loaderPath)) { include_once $loaderPath; } self::$configs = Yaml::loadWrapped($yamlString); \XoopsLoad::startAutoloader(self::$configs['lib-path']); } elseif (is_array($config)) { self::$configs = $config; \XoopsLoad::startAutoloader(self::$configs['lib-path']); } if (!isset(self::$configs['lib-path'])) { throw new \Exception('XoopsBaseConfig lib-path not defined.'); return; } \XoopsLoad::startAutoloader(self::$configs['lib-path']); }