public function files($directoryName)
    {
        if (!$this->isDir($directoryName)) {
            throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
        }

        $files = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($directoryName,
                RecursiveDirectoryIterator::SKIP_DOTS
            )
        );

        return array_filter(iterator_to_array($files), 'is_file');
    }
public function files($directoryName)
    {
        if (!$this->isDir($directoryName)) {
            throw new FileNotFoundException('Directory not found in the path [ ' . $directoryName . ' ].');
        }

        $files = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($directoryName,
                RecursiveDirectoryIterator::SKIP_DOTS
            )
        );

        return array_filter(iterator_to_array($files), 'is_file');
    }
public function files ( $ directoryName ) { if ( ! $ this -> isDir ( $ directoryName ) ) { throw new FileNotFoundException ( 'Directory not found in the path [ ' . $ directoryName . ' ].' ) ; } $ files = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ directoryName , RecursiveDirectoryIterator :: SKIP_DOTS ) ) ; return array_filter ( iterator_to_array ( $ files ) , 'is_file' ) ; }
To get all files in a directory

@param string $directoryName

@return array
@throws FileNotFoundException
To get all files in a directory