Documentation

rex_dir
in package

Class for handling directories.

Tags
author

gharlan

Table of Contents

Methods

copy()  : bool
Copies a directory.
create()  : bool
Creates a directory.
delete()  : bool
Deletes a directory.
deleteFiles()  : bool
Deletes the files in a directory.
deleteIterator()  : bool
Deletes files and directories by a rex_dir_iterator.
isWritable()  : bool
Returns wether the directory is writable.

Methods

copy()

Copies a directory.

public static copy(string $srcdir, string $dstdir) : bool
Parameters
$srcdir : string

Path of the source directory

$dstdir : string

Path of the destination directory

Tags
psalm-assert-if-true

=non-empty-string $srcdir

psalm-assert-if-true

=non-empty-string $dstdir

Return values
bool

TRUE on success, FALSE on failure

create()

Creates a directory.

public static create(string $dir[, bool $recursive = true ]) : bool
Parameters
$dir : string

Path of the new directory

$recursive : bool = true

When FALSE, nested directories won't be created

Tags
psalm-assert-if-true

=non-empty-string $dir

Return values
bool

TRUE on success, FALSE on failure

delete()

Deletes a directory.

public static delete(string $dir[, bool $deleteSelf = true ]) : bool
Parameters
$dir : string

Path of the directory

$deleteSelf : bool = true

When FALSE, only subdirectories and files will be deleted

Return values
bool

TRUE on success, FALSE on failure

deleteFiles()

Deletes the files in a directory.

public static deleteFiles(string $dir[, bool $recursive = true ]) : bool
Parameters
$dir : string

Path of the directory

$recursive : bool = true

When FALSE, files in subdirectories won't be deleted

Return values
bool

TRUE on success, FALSE on failure

deleteIterator()

Deletes files and directories by a rex_dir_iterator.

public static deleteIterator(Traversable<string|int, SplFileInfo$iterator) : bool
Parameters
$iterator : Traversable<string|int, SplFileInfo>

Iterator, $iterator->current() must return a SplFileInfo-Object

Return values
bool

TRUE on success, FALSE on failure

isWritable()

Returns wether the directory is writable.

public static isWritable(string $dir) : bool
Parameters
$dir : string

Path of the directory

Tags
psalm-assert-if-true

=non-empty-string $dir

Return values
bool

        
On this page

Search results