public function listFiles( $filter = NULL ) : array
    {
        $path = $this->path;

        if ( !file_exists($path) )    return NULL;

        if ( !is_readable($path) )    return NULL;

        if ( is_file($path) )    return NULL;

        $files = array();

        $dh = opendir($path);
        while( ($file_name = readdir($dh)) !== FALSE ){
            if ( $file_name === '.' || $file_name === '..' ){
                continue;
            }
            $file = new File( $file_name, $this );
            if ( $filter ){
                if ( $filter instanceof FileFilterInterface ){
                    if ( $filter->accept($file) ){
                        $files[] = $file;
                    }
                }
                else if ( is_callable($filter) ){
                    if ( $filter($file) ){
                        $files[] = $file;
                    }
                }
            }
            else{
                $files[] = $file;
            }
        }
        return $files;
    }
public function listFiles( $filter = NULL ) : array
    {
        $path = $this->path;

        if ( !file_exists($path) )    return NULL;

        if ( !is_readable($path) )    return NULL;

        if ( is_file($path) )    return NULL;

        $files = array();

        $dh = opendir($path);
        while( ($file_name = readdir($dh)) !== FALSE ){
            if ( $file_name === '.' || $file_name === '..' ){
                continue;
            }
            $file = new File( $file_name, $this );
            if ( $filter ){
                if ( $filter instanceof FileFilterInterface ){
                    if ( $filter->accept($file) ){
                        $files[] = $file;
                    }
                }
                else if ( is_callable($filter) ){
                    if ( $filter($file) ){
                        $files[] = $file;
                    }
                }
            }
            else{
                $files[] = $file;
            }
        }
        return $files;
    }
public function listFiles ( $ filter = NULL ) : array { $ path = $ this -> path ; if ( ! file_exists ( $ path ) ) return NULL ; if ( ! is_readable ( $ path ) ) return NULL ; if ( is_file ( $ path ) ) return NULL ; $ files = array ( ) ; $ dh = opendir ( $ path ) ; while ( ( $ file_name = readdir ( $ dh ) ) !== FALSE ) { if ( $ file_name === '.' || $ file_name === '..' ) { continue ; } $ file = new File ( $ file_name , $ this ) ; if ( $ filter ) { if ( $ filter instanceof FileFilterInterface ) { if ( $ filter -> accept ( $ file ) ) { $ files [ ] = $ file ; } } else if ( is_callable ( $ filter ) ) { if ( $ filter ( $ file ) ) { $ files [ ] = $ file ; } } } else { $ files [ ] = $ file ; } } return $ files ; }
Listing up files in directory which this object means

@param FileFilterInterface|callable $filter       Fileter object which implements selection logic. If this parameter is omitted, all files will be selected.

@return File[]
Listing up files in directory which this object means