original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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[]
docstring_tokens: Listing up files in directory which this object means