FileTree final class
Minn\Support\FileTree · public/minn/src/Minn/Support/FileTree.php · 146 lines
Whole-directory reads and copies. The engine's own installer, the update unpacker and the plugins that reach for WordPress's copy_dir all want the same two operations: list a tree, and duplicate one.
Public
| static | files(string $dir, int $depth = 0, array $skip = array ( )): array|false# | Every file under a directory, as list_files gives them: names starting with a dot left out, the names in $skip left out at the top level only, an empty folder named with a trailing slash. Depth 0 means no limit; at the depth given a folder is named with its slash instead of entered.
@return list<string>|false false when the directory cannot be read | |||
| static | filesWithHidden(string $dir, int $depth = 0, array $skip = array ( )): array|false# | As files(), dot files and folders included.
@return list<string>|false | |||
| static | copy(string $from, string $to, array $skip = array ( )): bool# | Copies a directory's contents into another, creating it if it is not there. Names in $skip are left behind at the top level only, which is how the update unpacker keeps a directory it means to preserve.
| |||
| static | copyThrough(object $fs, string $from, string $to, array $skip, int $fileMode, int $dirMode): ?array# | A directory copied through a WordPress filesystem object, as copy_dir copies it: the source listed, the destination made when it is missing, each file copied (once more after a chmod when the first copy fails), each missing folder made and copied in turn. A name in $skip is left out at its own level, "folder/name" one level down. Null when it all copied, else the refusal's code and data.
@return array{0: string, 1: string}|null | |||
| static | listedFiles(mixed $listing, string $dir): array# | The files of a recursive filesystem listing (dirlist), each as a path under $dir, in listing order, folders' files where the folder stands. @return list<string> |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | walk(string $dir, int $depth, array $skip, ?string $hiddenPrefix, int $level): array|false# |
@return list<string>|false |
Nothing matches.