Properties

$processExecutor

$processExecutor : 

Type

Methods

remove()

remove(  $file) 

Parameters

$file

isDirEmpty()

isDirEmpty(string  $dir) : boolean

Checks if a directory is empty

Parameters

string $dir

Returns

boolean

emptyDirectory()

emptyDirectory(  $dir,   $ensureDirectoryExists = true) 

Parameters

$dir
$ensureDirectoryExists

removeDirectory()

removeDirectory(string  $directory) : boolean

Recursively remove a directory

Uses the process component if proc_open is enabled on the PHP installation.

Parameters

string $directory

Throws

\RuntimeException

Returns

boolean

removeDirectoryPhp()

removeDirectoryPhp(string  $directory) : boolean

Recursively delete directory using PHP iterators.

Uses a CHILD_FIRST RecursiveIteratorIterator to sort files before directories, creating a single non-recursive loop to delete files/directories in the correct order.

Parameters

string $directory

Returns

boolean

ensureDirectoryExists()

ensureDirectoryExists(  $directory) 

Parameters

$directory

unlink()

unlink(string  $path) : boolean

Attempts to unlink a file and in case of failure retries after 350ms on windows

Parameters

string $path

Throws

\RuntimeException

Returns

boolean

rmdir()

rmdir(string  $path) : boolean

Attempts to rmdir a file and in case of failure retries after 350ms on windows

Parameters

string $path

Throws

\RuntimeException

Returns

boolean

copyThenRemove()

copyThenRemove(string  $source, string  $target) 

Copy then delete is a non-atomic version of {@link rename}.

Some systems can't rename and also don't have proc_open, which requires this solution.

Parameters

string $source
string $target

copy()

copy(  $source,   $target) : boolean

Copies a file or directory from $source to $target.

Parameters

$source
$target

Returns

boolean

rename()

rename(  $source,   $target) 

Parameters

$source
$target

findShortestPath()

findShortestPath(string  $from, string  $to, boolean  $directories = false) : string

Returns the shortest path from $from to $to

Parameters

string $from
string $to
boolean $directories

if true, the source/target are considered to be directories

Throws

\InvalidArgumentException

Returns

string

findShortestPathCode()

findShortestPathCode(string  $from, string  $to, boolean  $directories = false, boolean  $staticCode = false) : string

Returns PHP code that, when executed in $from, will return the path to $to

Parameters

string $from
string $to
boolean $directories

if true, the source/target are considered to be directories

boolean $staticCode

Throws

\InvalidArgumentException

Returns

string

isAbsolutePath()

isAbsolutePath(string  $path) : boolean

Checks if the given path is absolute

Parameters

string $path

Returns

boolean

size()

size(string  $path) : integer

Returns size of a file or directory specified by path. If a directory is given, it's size will be computed recursively.

Parameters

string $path

Path to the file or directory

Throws

\RuntimeException

Returns

integer

normalizePath()

normalizePath(string  $path) : string

Normalize a path. This replaces backslashes with slashes, removes ending slash and collapses redundant separators and up-level references.

Parameters

string $path

Path to the file or directory

Returns

string

isLocalPath()

isLocalPath(string  $path) : boolean

Return if the given path is local

Parameters

string $path

Returns

boolean

getPlatformPath()

getPlatformPath(  $path) 

Parameters

$path

relativeSymlink()

relativeSymlink(string  $target, string  $link) : boolean

Creates a relative symlink from $link to $target

Parameters

string $target

The path of the binary file to be symlinked

string $link

The path where the symlink should be created

Returns

boolean

isSymlinkedDirectory()

isSymlinkedDirectory(string  $directory) : boolean

return true if that directory is a symlink.

Parameters

string $directory

Returns

boolean

junction()

junction(string  $target, string  $junction) 

Creates an NTFS junction.

Parameters

string $target
string $junction

isJunction()

isJunction(string  $junction) : boolean

Returns whether the target directory is a Windows NTFS Junction.

Parameters

string $junction

Path to check.

Returns

boolean

removeJunction()

removeJunction(string  $junction) : boolean

Removes a Windows NTFS junction.

Parameters

string $junction

Returns

boolean

directorySize()

directorySize(  $directory) 

Parameters

$directory

getProcess()

getProcess() 

unlinkImplementation()

unlinkImplementation(string  $path) : boolean

delete symbolic link implementation (commonly known as "unlink()")

symbolic links on windows which link to directories need rmdir instead of unlink

Parameters

string $path

Returns

boolean

unlinkSymlinkedDirectory()

unlinkSymlinkedDirectory(string  $directory) : boolean

Parameters

string $directory

Returns

boolean

resolveSymlinkedDirectorySymlink()

resolveSymlinkedDirectorySymlink(string  $pathname) : string

resolve pathname to symbolic link of a directory

Parameters

string $pathname

directory path to resolve

Returns

string —

resolved path to symbolic link or original pathname (unresolved)