src/Abstracts/AbstractSftp.php
protected function listItem($type, $dir = '/.', $recursive = false, $ignore = array())
    {
        if ($type == 'dir') {
            $bool = true;
        } elseif ($type == 'file') {
            $bool = false;
        } else {
            throw new \InvalidArgumentException('$type must "file" or "dir"');
        }
        
        $parseDir = $this->parseLastDirectory($dir);
        $sDir = $this->getWrapper($parseDir);
        $fileList = array_diff(scandir($sDir), array('..', '.'));
        
        $fileInfo = array();
        foreach ($fileList as $file) {
            if ($this->ignoreItem($type, $file, $ignore) !== true && is_dir("$sDir/$file") === $bool) {
                $fileInfo[] = $file;
            }
            if ($recursive === true && is_dir("$sDir/$file") === true) {
                $fileInfo = array_merge($fileInfo, $this->listItem($type, "$dir/$file", $recursive, $ignore));
            }
        }
        
        return $fileInfo;
    }
protected function listItem($type, $dir = '/.', $recursive = false, $ignore = array())
    {
        if ($type == 'dir') {
            $bool = true;
        } elseif ($type == 'file') {
            $bool = false;
        } else {
            throw new \InvalidArgumentException('$type must "file" or "dir"');
        }
        
        $parseDir = $this->parseLastDirectory($dir);
        $sDir = $this->getWrapper($parseDir);
        $fileList = array_diff(scandir($sDir), array('..', '.'));
        
        $fileInfo = array();
        foreach ($fileList as $file) {
            if ($this->ignoreItem($type, $file, $ignore) !== true && is_dir("$sDir/$file") === $bool) {
                $fileInfo[] = $file;
            }
            if ($recursive === true && is_dir("$sDir/$file") === true) {
                $fileInfo = array_merge($fileInfo, $this->listItem($type, "$dir/$file", $recursive, $ignore));
            }
        }
        
        return $fileInfo;
    }
protected function listItem ( $ type , $ dir = '/.' , $ recursive = false , $ ignore = array ( ) ) { if ( $ type == 'dir' ) { $ bool = true ; } elseif ( $ type == 'file' ) { $ bool = false ; } else { throw new \ InvalidArgumentException ( '$type must "file" or "dir"' ) ; } $ parseDir = $ this -> parseLastDirectory ( $ dir ) ; $ sDir = $ this -> getWrapper ( $ parseDir ) ; $ fileList = array_diff ( scandir ( $ sDir ) , array ( '..' , '.' ) ) ; $ fileInfo = array ( ) ; foreach ( $ fileList as $ file ) { if ( $ this -> ignoreItem ( $ type , $ file , $ ignore ) !== true && is_dir ( "$sDir/$file" ) === $ bool ) { $ fileInfo [ ] = $ file ; } if ( $ recursive === true && is_dir ( "$sDir/$file" ) === true ) { $ fileInfo = array_merge ( $ fileInfo , $ this -> listItem ( $ type , "$dir/$file" , $ recursive , $ ignore ) ) ; } } return $ fileInfo ; }
List of file

@link http://php.net/scandir Php manuel
@access public
@param string $dir ssh directory name
@return array file list
@throws FileException
List of file