final class FileSystem

File system tool.

Methods

static void
createDir(string $dir, int $mode = 0777)

Creates a directory.

static void
copy(string $source, string $dest, bool $overwrite = true)

Copies a file or directory.

static void
delete(string $path)

Deletes a file or directory.

static void
rename(string $name, string $newName, bool $overwrite = true)

Renames a file or directory.

static string
read(string $file)

Reads file content.

static void
write(string $file, string $content, int|null $mode = 0666)

Writes a string to a file.

static bool
isAbsolute(string $path)

Is path absolute?

Details

at line 26
static void createDir(string $dir, int $mode = 0777)

Creates a directory.

Parameters

string $dir
int $mode

Return Value

void

Exceptions

IOException

at line 38
static void copy(string $source, string $dest, bool $overwrite = true)

Copies a file or directory.

Parameters

string $source
string $dest
bool $overwrite

Return Value

void

Exceptions

IOException

at line 72
static void delete(string $path)

Deletes a file or directory.

Parameters

string $path

Return Value

void

Exceptions

IOException

at line 96
static void rename(string $name, string $newName, bool $overwrite = true)

Renames a file or directory.

Parameters

string $name
string $newName
bool $overwrite

Return Value

void

Exceptions

IOException
InvalidStateException

at line 120
static string read(string $file)

Reads file content.

Parameters

string $file

Return Value

string

Exceptions

IOException

at line 134
static void write(string $file, string $content, int|null $mode = 0666)

Writes a string to a file.

Parameters

string $file
string $content
int|null $mode

Return Value

void

Exceptions

IOException

at line 149
static bool isAbsolute(string $path)

Is path absolute?

Parameters

string $path

Return Value

bool

Traits

Static class.