You appear to be a bot. Output may be restricted
Description
Usage
WP_Filesystem_MockFS::dirlist( $path, $include_hidden, $recursive );
Parameters
- $path
- ( mixed ) optional default: . –
- $include_hidden
- ( mixed ) optional default: 1 –
- $recursive
- ( mixed ) optional –
Returns
void
Source
File name: wordpress-develop-tests/phpunit/includes/mock-fs.php
Lines:
1 to 47 of 47
public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { if ( empty( $path ) || '.' === $path ) { $path = $this->cwd(); } if ( ! $this->exists( $path ) ) { return false; } $limit_file = false; if ( $this->is_file( $path ) ) { $limit_file = $this->locate_node( $path )->name; $path = dirname( $path ) . '/'; } $ret = array(); foreach ( $this->fs_map[ $path ]->children as $entry ) { if ( '.' === $entry->name || '..' === $entry->name ) { continue; } if ( ! $include_hidden && '.' === $entry->name ) { continue; } if ( $limit_file && $entry->name !== $limit_file ) { continue; } $struc = array(); $struc['name'] = $entry->name; $struc['type'] = $entry->type; if ( 'd' === $struc['type'] ) { if ( $recursive ) { $struc['files'] = $this->dirlist( trailingslashit( $path ) . trailingslashit( $struc['name'] ), $include_hidden, $recursive ); } else { $struc['files'] = array(); } } $ret[ $entry->name ] = $struc; } return $ret; }