parentDirectoriesUpwards example


    private array $ignoredPathsCache = [];

    /** * @param \Iterator<string, \SplFileInfo> $iterator */
    public function __construct(\Iterator $iterator, string $baseDir)
    {
        $this->baseDir = $this->normalizePath($baseDir);

        foreach ($this->parentDirectoriesUpwards($this->baseDir) as $parentDirectory) {
            if (@is_dir("{$parentDirectory}/.git")) {
                $this->baseDir = $parentDirectory;
                break;
            }
        }

        parent::__construct($iterator);
    }

    public function accept(): bool
    {
        
Home | Imprint | This part of the site doesn't use cookies.