protected function processDirectory(string $path = '', array &$worklist = []): void
    {
        $dir = new DirectoryIterator($this->basePath . $path);

        foreach ($dir as $item) {
            if ($item->isDot()) {
                continue;
            }

            $itemPath = $path . $item->getFilename();

            if ($this->exclude($itemPath)) {
                continue;
            }

            if ($item->isFile() && $item->getExtension() == 'php') {
                $worklist[] = $item->getFileInfo();
            }

            if ($item->isDir()) {
                $this->processDirectory($itemPath . '/', $worklist);
            }
        }
    }
protected function processDirectory(string $path = '', array &$worklist = []): void
    {
        $dir = new DirectoryIterator($this->basePath . $path);

        foreach ($dir as $item) {
            if ($item->isDot()) {
                continue;
            }

            $itemPath = $path . $item->getFilename();

            if ($this->exclude($itemPath)) {
                continue;
            }

            if ($item->isFile() && $item->getExtension() == 'php') {
                $worklist[] = $item->getFileInfo();
            }

            if ($item->isDir()) {
                $this->processDirectory($itemPath . '/', $worklist);
            }
        }
    }
protected function processDirectory ( string $ path = '' , array & $ worklist = [ ] ) : void { $ dir = new DirectoryIterator ( $ this -> basePath . $ path ) ; foreach ( $ dir as $ item ) { if ( $ item -> isDot ( ) ) { continue ; } $ itemPath = $ path . $ item -> getFilename ( ) ; if ( $ this -> exclude ( $ itemPath ) ) { continue ; } if ( $ item -> isFile ( ) && $ item -> getExtension ( ) == 'php' ) { $ worklist [ ] = $ item -> getFileInfo ( ) ; } if ( $ item -> isDir ( ) ) { $ this -> processDirectory ( $ itemPath . '/' , $ worklist ) ; } } }
Iterate through a directory and check all of the PHP files within it.

@param string $path
@param SplFileInfo[] $worklist
Iterate through a directory and check all of the PHP files within it .