Returns the settings by the given configuration file.

@param string $path
@return SettingsContract
@throws FileNotFoundException
964720
public function createFromConfig(string $path) : SettingsContract {
        $configData = (array) $this->filesystem->getRequire($path);

        return $this->createFromData($configData);
    }
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);
    }
740244
private function getFiles($path)
    {
        if (is_file($path)) {
            return [new SplFileInfo($path, '', '')];
        }

        return $this->finder->name('*.php')->in(realpath($path));
    }
1317438
public function &get($path = '')
  {
    $this->_tmp = &$this->_current;
    $this->_shiftTmp($path);
    return $this->_tmp;
  }
45936
public function read($path)
    {
        $config = $this
            ->readByFilename(
                $path,
                Visithor::CONFIG_FILE_NAME_DISTR
            );

        if (false === $config) {
            $config = $this
                ->readByFilename(
                    $path,
                    Visithor::CONFIG_FILE_NAME
                );
        }

        return $config;
    }
873314
public function load($path)
    {
        if (!file_exists($path)) {
            throw new FileNotFoundException(sprintf('File "%s" does not exist or is unreadable', $path));
        }

        ob_start();
        include $path;
        $contents = ob_get_clean();

        return $contents;
    }
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;
    }
278870
public function get(string $path): File {
		return (new File(Paths::appendPath($this->getUrl(), $path)))->addFilters($this->recursiveFilter, true);
	}
370075
public function getFile($path)
    {
        $file = new File($this->getFileSystemId(), $this->getFullPath($path));
        $file->setServiceLocator($this->getServiceLocator());
        return $file;
    }
100742
public function get($path)
    {
        $configValue = $this->getRepository()->findOneByPath($path);
        if ($configValue) {
            return $configValue->getValue();
        }

        return null;
    }
554953
protected function _findPath($path)
    {
        $path = $this->_unifyPath($path);
        $dirs = $this->_dirs;

        $file = null;

        foreach ($dirs as $dir) {
            if (is_readable(realpath($dir.DS.$path))) {
                $file = $dir.DS.$path;
                break;
            }
        }

        return $file;
    }
400433
public function getFinder($path = '')
    {
        $path = Util::normalizePath($path);

        $adapter = $this->getAdapter();
        if (!$adapter instanceof FindableAdapterInterface) {
            throw new NotSupportedException(
                "Adapter doesn't support getFinder action. Adapter in use is: "
                . get_class($adapter)
            );
        }

        return $adapter->getFinder($path);
    }
738354
private function loadConfigurationFiles($path)
    {
        $this->configPath = $path;

        foreach ($this->getConfigurationFiles() as $fileKey => $path) {
            $this->set($fileKey, require $path);
        }

        foreach ($this->getConfigurationFiles() as $fileKey => $path) {
            $envConfig = require $path;

            foreach ($envConfig as $envKey => $value) {
                $this->set($fileKey.'.'.$envKey, $value);
            }
        }
    }
400197
public function loadDIConfigFile(string $path): DIConfigWrapper
    {
        $yamlArray = [];

        if (file_exists($path)) {
            $yamlArray = Yaml::parse(file_get_contents($path)) ?? [];
        }

        return new DIConfigWrapper($yamlArray);
    }
984365
public function setWorkingDirectory($path)
    {
        $path = $this->prefixDirectoryStack($path);

        if ($this->files->exists($path))
        {
            return $this->directoryStack[] = $path;
        }

        throw new DirectoryNotFoundException("Directory [{$path}] could not be found.");
    }
253981
protected function getConfig(string $path = '', bool $failIfNotFound = false) : Config
    {
        $this->config = Config\Factory::create($path);

        if ($failIfNotFound && !$this->config->isLoadedFromFile()) {
            throw new \RuntimeException(
                'Please create a captainhook configuration first' . PHP_EOL .
                'Run \'captainhook configure\'' . PHP_EOL .
                'If you have a configuration located elsewhere use the --configuration option'
            );
        }
        return $this->config;
    }
1115649
public function addConfigPath($path)
    {
        if (!file_exists($path) || !is_dir($path) || !is_readable($path)) {
            throw new Exception(
                'Invalid or unreadable path: '.$path,
                Exception::INVALID_PATH
            );
        }
        $this->configPaths[] = $path;

        return $this;
    }