private function yieldFilesInPath(SpecificationInterface $specification, string $path): Generator
    {
        $listContents = $this->filesystem->listContents($path);
        foreach ($listContents as $location) {
            if ($specification->isSatisfiedBy($location)) {
                yield $location;
            }

            if ($location['type'] === 'dir') {
                foreach ($this->yieldFilesInPath($specification, $location['path']) as $returnedLocation) {
                    yield $returnedLocation;
                }
            }
        }
    }
private function yieldFilesInPath(SpecificationInterface $specification, string $path): Generator
    {
        $listContents = $this->filesystem->listContents($path);
        foreach ($listContents as $location) {
            if ($specification->isSatisfiedBy($location)) {
                yield $location;
            }

            if ($location['type'] === 'dir') {
                foreach ($this->yieldFilesInPath($specification, $location['path']) as $returnedLocation) {
                    yield $returnedLocation;
                }
            }
        }
    }
private function yieldFilesInPath ( SpecificationInterface $ specification , string $ path ) : Generator { $ listContents = $ this -> filesystem -> listContents ( $ path ) ; foreach ( $ listContents as $ location ) { if ( $ specification -> isSatisfiedBy ( $ location ) ) { yield $ location ; } if ( $ location [ 'type' ] === 'dir' ) { foreach ( $ this -> yieldFilesInPath ( $ specification , $ location [ 'path' ] ) as $ returnedLocation ) { yield $ returnedLocation ; } } } }
Recursively yield files that meet the specification

Note that directories are also yielded at this level,
since they have to be recursed into.  Yielded directories
will not make their way back to the caller, as they are filtered out
by {@link handle()}.
Recursively yield files that meet the specification