Locate config files from path.
@param $path
@return FilesystemResource|bool
359631
public function locate($path)
    {
        $repository = $this->getRepository();

        if(!$repository->contains($path)){
            throw new \InvalidArgumentException(sprintf('Their is no path %s in repository.', $path));
        }

        $resource = $repository->get($path);

        if(!($resource instanceof FilesystemResource)){
            throw new \RuntimeException(['Expect %s! %s given', FilesystemResource::class, get_class($resource)]);
        }

        return $resource;
    }
1205157
public function getConfigValue($path)
    {
        return $this->relevanceConfig->getValue($path, $this->getScope(), $this->getScopeCode());
    }
1144658
public function find($path)
    {
        $language = $this->getLanguage();
        $fallback = $this->getLanguageFallback();
        $locator  = $this->getObject('translator.locator.factory')->createLocator($path);

        $results = [];

        // Try to load the fallback translations first
        if ($fallback && $fallback != $language)
        {
            if ($result = $locator->locate($path .'/'.$fallback.'/'.$fallback.'.*')) {
                $results[] = $result;
            }
        }

        // Find translations based on the language
        if ($result = $locator->locate($path .'/'.$language.'/'.$language.'.*')) {
            $results[] = $result;
        }

        return $results;
    }
1122543
protected function getConfigurationFiles($path)
	{
		$files = [];

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

		return $files;
	}
141932
public function setFileInfoFromPath($path)
    {
        $info = pathinfo($path);
        $this->dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null;
        $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null;
        $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null;
        $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null;

        if (file_exists($path) && is_file($path)) {
            $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
        }

        return $this;
    }
603300
protected function getPathInResources($path)
  {
    if (strncmp($path, $this->parentResourceDirFullPath, strlen($this->parentResourceDirFullPath))!=0)
    {
      throw new \BuildException(sprintf("Resource file '%s' is not under resource dir '%s'.",
                                        $path,
                                        $this->parentResourceDirFullPath));
    }

    return substr($path, strlen($this->parentResourceDirFullPath));
  }
1311395
protected static function loadEnvConfigs($path)
    {
        if (isset(self::$envConfig[$path])) {
            return self::$envConfig[$path];
        }
        if (!is_dir($path)) {
            self::$envConfig[$path] = [];
            return self::$envConfig[$path];
        }

        $envFiles = Finder::create()
            ->files()
            ->name('*.yml')
            ->in($path)
            ->depth('< 2');

        $envConfig = [];
        /** @var SplFileInfo $envFile */
        foreach ($envFiles as $envFile) {
            $env = str_replace(['.dist.yml', '.yml'], '', $envFile->getFilename());
            $envConfig[$env] = [];
            $envPath = $path;
            if ($envFile->getRelativePath()) {
                $envPath .= DIRECTORY_SEPARATOR . $envFile->getRelativePath();
            }
            foreach (['.dist.yml', '.yml'] as $suffix) {
                $envConf = self::getConfFromFile($envPath . DIRECTORY_SEPARATOR . $env . $suffix, null);
                if ($envConf === null) {
                    continue;
                }
                $envConfig[$env] = self::mergeConfigs($envConfig[$env], $envConf);
            }
        }

        self::$envConfig[$path] = ['env' => $envConfig];
        return self::$envConfig[$path];
    }
1249474
public static function findRepositoryRoot($path)
    {
        return FileSystem::bubble($path, function($p) {
            $gitDir = $p.'/'.'.git';
            return file_exists($gitDir) && is_dir($gitDir);
        });
    }
415190
public static function config($path)
    {
        $data = \UtilsSandboxLoader('application/Config/' . strtr($path, '.', '/') . '.php');

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

        $data = null;
    }
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);
    }
1196625
public function getLocatorPath($path)
	{
		if (!isset($this->locator->$path))
		{
			return false;
		}

		return $this->locator->$path;
	}
659047
protected function getScandir($path) {
		$files = array();
		
		!isset($this->dirsCache[$path]) && $this->cacheDir($path);

		foreach ($this->dirsCache[$path] as $p) {
			if (($stat = $this->stat($p)) && empty($stat['hidden'])) {
				$files[] = $stat;
			}
		}

		return $files;
	}
98409
private function locate_node( $path ) {
		return isset( $this->fs_map[ $path ] ) ? $this->fs_map[ $path ] : false;
	}
742630
public static function getResourcePath($path)
    {
        if (self::$importPaths === null) {
            self::$importPaths = self::explodeIncludePath();
        }

        $path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path);

        foreach (self::$importPaths as $prefix) {
            $testPath = $prefix . DIRECTORY_SEPARATOR . $path;
            if (file_exists($testPath)) {
                return $testPath;
            }
        }

        // Check for the property phing.home
        $homeDir = self::getProperty(self::PHING_HOME);
        if ($homeDir) {
            $testPath = $homeDir . DIRECTORY_SEPARATOR . $path;
            if (file_exists($testPath)) {
                return $testPath;
            }
        }

        // Check for the phing home of phar archive
        if (strpos(self::$importPaths[0], 'phar://') === 0) {
            $testPath = self::$importPaths[0] . '/../' . $path;
            if (file_exists($testPath)) {
                return $testPath;
            }
        }

        // Do one additional check based on path of current file (Phing.php)
        $maybeHomeDir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
        $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path;
        if (file_exists($testPath)) {
            return $testPath;
        }

        return null;
    }
98105
public function findPhp($path)
    {
        $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
        $phpFiles = new RegexIterator($allFiles, '/\.php$/');
        $files = array();
        foreach ($phpFiles as $phpFile) {
            $filename = $phpFile->getRealpath();
            $content = file_get_contents($filename);
            $files[] = new File($filename, $content);
        }

        return $files;
    }
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';
		}
	}
559969
protected function matchEnvironment($path) {
        $env = $this->getEnvironmentDetector()
            ->detectEnvironment(basename($path));

        if ($env === null || $env == $this->getEnvironment()) {
            return true;
        }

        return false;
    }