protected function readMonitoredDirectoryRecursively($path, $filenamePattern)
    {
        $directories = [Files::getNormalizedPath($path)];
        while ($directories !== []) {
            $currentDirectory = array_pop($directories);
            if (is_file($currentDirectory . '.flowFileMonitorIgnore')) {
                continue;
            }
            if ($handle = opendir($currentDirectory)) {
                while (false !== ($filename = readdir($handle))) {
                    if ($filename[0] === '.') {
                        continue;
                    }
                    $pathAndFilename = $currentDirectory . $filename;
                    if (is_dir($pathAndFilename)) {
                        array_push($directories, $pathAndFilename . DIRECTORY_SEPARATOR);
                    } elseif ($filenamePattern === null || preg_match('|' . $filenamePattern . '|', $filename) === 1) {
                        yield $pathAndFilename;
                    }
                }
                closedir($handle);
            }
        }
    }
protected function readMonitoredDirectoryRecursively($path, $filenamePattern)
    {
        $directories = [Files::getNormalizedPath($path)];
        while ($directories !== []) {
            $currentDirectory = array_pop($directories);
            if (is_file($currentDirectory . '.flowFileMonitorIgnore')) {
                continue;
            }
            if ($handle = opendir($currentDirectory)) {
                while (false !== ($filename = readdir($handle))) {
                    if ($filename[0] === '.') {
                        continue;
                    }
                    $pathAndFilename = $currentDirectory . $filename;
                    if (is_dir($pathAndFilename)) {
                        array_push($directories, $pathAndFilename . DIRECTORY_SEPARATOR);
                    } elseif ($filenamePattern === null || preg_match('|' . $filenamePattern . '|', $filename) === 1) {
                        yield $pathAndFilename;
                    }
                }
                closedir($handle);
            }
        }
    }
protected function readMonitoredDirectoryRecursively ( $ path , $ filenamePattern ) { $ directories = [ Files :: getNormalizedPath ( $ path ) ] ; while ( $ directories !== [ ] ) { $ currentDirectory = array_pop ( $ directories ) ; if ( is_file ( $ currentDirectory . '.flowFileMonitorIgnore' ) ) { continue ; } if ( $ handle = opendir ( $ currentDirectory ) ) { while ( false !== ( $ filename = readdir ( $ handle ) ) ) { if ( $ filename [ 0 ] === '.' ) { continue ; } $ pathAndFilename = $ currentDirectory . $ filename ; if ( is_dir ( $ pathAndFilename ) ) { array_push ( $ directories , $ pathAndFilename . DIRECTORY_SEPARATOR ) ; } elseif ( $ filenamePattern === null || preg_match ( '|' . $ filenamePattern . '|' , $ filename ) === 1 ) { yield $ pathAndFilename ; } } closedir ( $ handle ) ; } } }
Read a monitored directory recursively, taking into account filename patterns

@param string $path The path of a monitored directory
@param string $filenamePattern
@return \Generator<string> A generator returning filenames with full path
Read a monitored directory recursively taking into account filename patterns