Get plugin configuration for load plugin.

@param string $path
@return array
194344
protected static function _getConfigForLoad($path)
    {
        $config    = ['autoload' => true];
        $routes    = $path . 'config' . DS . Plugin::FILE_ROUTES;
        $bootstrap = $path . 'config' . DS . Plugin::FILE_BOOTSTRAP;

        if (FS::isFile($bootstrap)) {
            $config['bootstrap'] = true;
        }

        if (FS::isFile($routes)) {
            $config['routes'] = true;
        }

        $config['path'] = $path;

        return $config;
    }
1085174
public function load($path)
    {
        $path = $this->findAbsolutePath($path);
        $hash = Yaml::parse(file_get_contents($path));

        $features = $this->loader->load($hash);
        $filename = $this->findRelativePath($path);

        return array_map(function (FeatureNode $feature) use ($filename) {
            return new FeatureNode(
                $feature->getTitle(),
                $feature->getDescription(),
                $feature->getTags(),
                $feature->getBackground(),
                $feature->getScenarios(),
                $feature->getKeyword(),
                $feature->getLanguage(),
                $filename,
                $feature->getLine()
            );
        }, $features);
    }
852869
protected function resolveFilePaths($paths)
    {
        $loadedPlugins = Plugin::loaded();

        return array_map(function ($path) use ($loadedPlugins) {
            $pluginSplit = pluginSplit($path);

            //Note that using `pluginSplit()` is not sufficient, because
            //  `$path` may still contain a dot
            if (!empty($pluginSplit[0]) && in_array($pluginSplit[0], $loadedPlugins)) {
                list($plugin, $path) = $pluginSplit;
            }

            $path = string_starts_with($path, '/') ? substr($path, 1) : $this->type . DS . $path;
            $path = DS === '/' ? $path : $path = str_replace('/', DS, $path);
            $path = empty($plugin) ? WWW_ROOT . $path : Plugin::path($plugin) . 'webroot' . DS . $path;

            //Appends the file extension, if not already present
            $path = pathinfo($path, PATHINFO_EXTENSION) == $this->type ? $path : sprintf('%s.%s', $path, $this->type);
            is_readable_or_fail($path);

            return $path;
        }, (array)$paths);
    }
824663
public function getConfig() {
		$result = [];
		$pluginName = $this->_getPluginName();
		if (empty($pluginName) || !Configure::check($pluginName)) {
			return $result;
		}

		$result = (array)Configure::read($pluginName);

		return $result;
	}
415190
public static function config($path)
    {
        $data = \UtilsSandboxLoader('application/Config/' . strtr($path, '.', '/') . '.php');

        foreach ($data as $key => $value) {
            self::env($key, $value);
        }

        $data = null;
    }
575289
public function getConfigValueFromPath($path)
    {
        /** @var Configuration $node */
        $node = $this->configuration;

        foreach (explode('/', $path) as $nodeName) {
            if (!is_object($node)) {
                return null;
            }

            $node = $node->{'get' . ucfirst($nodeName)}();
        }

        return $node;
    }
906622
private function getValidPath($path)
    {
        // If `$path` is array
        if (is_array($path)) {
            return $this->getPathFromArray($path);
        }

        // If `$path` is a directory
        if (is_dir($path)) {
            $paths = glob($path . '/*.*');
            if (empty($paths)) {
                throw new EmptyDirectoryException("Configuration directory: [$path] is empty");
            }
            return $paths;
        }

        // If `$path` is not a file, throw an exception
        if (!file_exists($path)) {
            throw new FileNotFoundException("Configuration file: [$path] cannot be found");
        }
        return array($path);
    }
726357
protected function loadConfigurationFile(string $configurationPath): array
    {
        $configurations = [];

        if ($configurationPath && is_dir($configurationPath)) {
            if (is_dir($configurationPath)) {
                $configurationFiles = new FilesystemIterator($configurationPath, FilesystemIterator::SKIP_DOTS);

                /** @var SplFileInfo $configurationFiles */
                foreach ($configurationFiles as $file) {
                    $configurations += $this->getConfigurationFile($file);
                }
            } else {
                if (is_file($configurationPath)) {
                    $configurations += $this->getConfigurationFile($configurationPath);
                }
            }
        }

        return $configurations;
    }
1137969
public function loadConfiguration($path = self::CONFIG_DEFAULT_FILE)
    {
        if (!is_file($path)) {
            return false;
        }

        $this->configuration = include $path;

        if (!is_array($this->configuration)) {
            throw new ConfigurationException('Configuration file ' . $path . ' must return an array');
        }

        $filesystem = new Filesystem();

        if ($filesystem->isAbsolutePath($this->configuration['web-dir'])) {
            $this->setDocumentRoot($this->configuration['web-dir']);
        } else {
            $this->setDocumentRoot($this->getRoot() . '/' . $this->configuration['web-dir']);
        }

        if (!is_dir($_SERVER['DOCUMENT_ROOT'])) {
            return false;
        }

        return true;
    }
407241
public static function config($path)
    {
        $peaces = explode('.', $path);
        $name = $peaces[0];
        array_shift($peaces);

        $config = null;
        if (isset(static::$configs[$name])) {
            $config = static::$configs[$name];
        }
        if (!$config) {
            $filename = path(true, "config/{$name}.php");
            if (file_exists($filename)) {
                /** @noinspection PhpIncludeInspection */
                $config = (object)require $filename;
                static::$configs[$name] = $config;
            }
        }
        if (count($peaces) === 0) {
            return $config;
        }

        return search((array)$config, $peaces);
    }
344381
public function getRouteOptions($path)
    {
        $routeName = ltrim($path, '/');
        if (!isset($this->routeOptions[$routeName])) {
            return [];
        }
        return $this->routeOptions[$routeName];
    }
790134
public function loadFile($path) {
        $content = trim(file_read($path));
        $config = [];

        if ( ! empty($content)) {
            $config = json_decode($content, true);

            if ( ! is_array($config)) {;
                throw new InvalidConfigFormatException(
                    s('JsonConfigDriver expects config at path %s to be a valid json file.', $path)
                );
            }
        }

        return $config;
    }
525720
protected function loadConfig( $path ) {
		$confPath = $path . '/.minus-x.json';
		if ( !file_exists( $confPath ) ) {
			return;
		}

		$config = json_decode( file_get_contents( $confPath ), true );
		if ( !is_array( $config ) ) {
			$this->output->writeln( 'Error: .minus-x.json is not valid JSON' );
			return 1;
		}

		if ( isset( $config['ignore'] ) ) {
			$this->ignoredFiles = array_map( function ( $a ) use ( $path ) {
				return realpath( $path . '/' . $a );
			}, $config['ignore'] );
		}

		if ( isset( $config['ignoreDirectories'] ) ) {
			$this->ignoredDirs = array_map( function ( $a ) use ( $path ) {
				return realpath( $path . '/' . $a );
			}, $config['ignoreDirectories'] );
		}

		if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
			// On Windows, is_executable() always returns true, so whitelist those
			// files
			$this->whitelist[] = 'application/x-dosexec';
		}
	}
449163
public function loadPlugins(string $pluginsPath)
    {
        $directories = Collection::make((new Filesystem())->directories($this->mupluginsPath()))
            ->map(function ($directory) {
                return ltrim(substr($directory, strrpos($directory, DS)), '\/');
            })->toArray();

        (new PluginsRepository($this, new Filesystem(), $pluginsPath, $this->getCachedPluginsPath()))
            ->load($directories);
    }
952221
public static function getModuleFiles(?string $path = null): array
    {
        $configs = [];

        if (empty($path)) {
            throw new InvalidArgumentException((string)__('Specify [path] for the JSON configs'));
        }

        $folder = new Folder($path);
        $files = $folder->findRecursive('.*\.json');

        if (!empty($files)) {
            $configs = $files;
        }

        return $configs;
    }
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);
    }
302458
protected function publishConfiguration($path)
    {
        // Compute and create the destination folder
        $destination = $this->paths->getConfigurationPath().'/plugins';

        // Export configuration
        $files = $this->files->listFiles($path, true);
        foreach ($files as $file) {
            $fileDestination = $destination.DS.$file['basename'];
            if ($this->files->has($destination) && !$this->force) {
                continue;
            }

            $this->files->forceCopy($file['path'], $fileDestination);
            $this->explainer->success('Published <comment>'.str_replace($this->paths->getBasePath(), null, $fileDestination).'</comment>');
        }
    }