src/ClassFinder.php
private function getFiles($directory)
    {
        $fileList = [];
        $files = scandir($directory);
        $this->log(sprintf("Scanning dir %s, found %d files", $directory, count($files)));
        foreach ($files as $index => $file) {
            // recursive retrieve files in subdirectories
            if (true === is_dir($directory . DIRECTORY_SEPARATOR . $file) && !in_array($file, [".", ".."])) {
                $fileList = array_merge(
                    $fileList,
                    $this->getFiles($directory . DIRECTORY_SEPARATOR . $file)
                );
                continue;
            }

            // not the file we want
            if (false === $this->isRequiredFile($file)) {
                $this->log(sprintf("Files %s is not required", $directory . DIRECTORY_SEPARATOR . $file));
                continue;
            }
            $this->log(sprintf("Collected %s", $directory . DIRECTORY_SEPARATOR . $file));
            $fileList[] = $directory . DIRECTORY_SEPARATOR . $file;
        }
        return $fileList;
    }
private function getFiles($directory)
    {
        $fileList = [];
        $files = scandir($directory);
        $this->log(sprintf("Scanning dir %s, found %d files", $directory, count($files)));
        foreach ($files as $index => $file) {
            // recursive retrieve files in subdirectories
            if (true === is_dir($directory . DIRECTORY_SEPARATOR . $file) && !in_array($file, [".", ".."])) {
                $fileList = array_merge(
                    $fileList,
                    $this->getFiles($directory . DIRECTORY_SEPARATOR . $file)
                );
                continue;
            }

            // not the file we want
            if (false === $this->isRequiredFile($file)) {
                $this->log(sprintf("Files %s is not required", $directory . DIRECTORY_SEPARATOR . $file));
                continue;
            }
            $this->log(sprintf("Collected %s", $directory . DIRECTORY_SEPARATOR . $file));
            $fileList[] = $directory . DIRECTORY_SEPARATOR . $file;
        }
        return $fileList;
    }
private function getFiles ( $ directory ) { $ fileList = [ ] ; $ files = scandir ( $ directory ) ; $ this -> log ( sprintf ( "Scanning dir %s, found %d files" , $ directory , count ( $ files ) ) ) ; foreach ( $ files as $ index => $ file ) { // recursive retrieve files in subdirectories if ( true === is_dir ( $ directory . DIRECTORY_SEPARATOR . $ file ) && ! in_array ( $ file , [ "." , ".." ] ) ) { $ fileList = array_merge ( $ fileList , $ this -> getFiles ( $ directory . DIRECTORY_SEPARATOR . $ file ) ) ; continue ; } // not the file we want if ( false === $ this -> isRequiredFile ( $ file ) ) { $ this -> log ( sprintf ( "Files %s is not required" , $ directory . DIRECTORY_SEPARATOR . $ file ) ) ; continue ; } $ this -> log ( sprintf ( "Collected %s" , $ directory . DIRECTORY_SEPARATOR . $ file ) ) ; $ fileList [ ] = $ directory . DIRECTORY_SEPARATOR . $ file ; } return $ fileList ; }
Scan a directory and list all files that correspond to given criteria
@param string $directory
@return array
Scan a directory and list all files that correspond to given criteria