original_string: public function ls($resource, $mode = self::LS_MODE_FILE, $recursive = false, $filter = null)
      {
          $files = [];
          list (, $paths, $path) = $this->_parse($resource);
  
          foreach ((array) $paths as $_path) {
              if (file_exists($_path . '/' . $path)) {
                  foreach ($this->_list(FS::clean($_path . '/' . $path), '', $mode, $recursive, $filter) as $file) {
                      if (!Arr::in($file, $files)) {
                          $files[] = $file;
                      }
                  }
              }
          }
  
          return $files;
      }
code: public function ls($resource, $mode = self::LS_MODE_FILE, $recursive = false, $filter = null)
      {
          $files = [];
          list (, $paths, $path) = $this->_parse($resource);
  
          foreach ((array) $paths as $_path) {
              if (file_exists($_path . '/' . $path)) {
                  foreach ($this->_list(FS::clean($_path . '/' . $path), '', $mode, $recursive, $filter) as $file) {
                      if (!Arr::in($file, $files)) {
                          $files[] = $file;
                      }
                  }
              }
          }
  
          return $files;
      }
code_tokens: public function ls ( $ resource , $ mode = self :: LS_MODE_FILE , $ recursive = false , $ filter = null ) { $ files = [ ] ; list ( , $ paths , $ path ) = $ this -> _parse ( $ resource ) ; foreach ( ( array ) $ paths as $ _path ) { if ( file_exists ( $ _path . '/' . $ path ) ) { foreach ( $ this -> _list ( FS :: clean ( $ _path . '/' . $ path ) , '' , $ mode , $ recursive , $ filter ) as $ file ) { if ( ! Arr :: in ( $ file , $ files ) ) { $ files [ ] = $ file ; } } } } return $ files ; }
docstring: Get a list of files or diretories from a resource.
  
  @param string $resource
  @param string $mode
  @param bool $recursive
  @param null $filter
  @return array
  @SuppressWarnings(PHPMD.ShortMethodName)
docstring_tokens: Get a list of files or diretories from a resource .