Helper class for handling file and directory paths.

package Default

 Methods

Returns whether a file path refers to the current or parent directory.

isDot(string|\FeaturePhp\Helper\SplFileInfo $fileName) : boolean
Static

Parameters

$fileName

string\FeaturePhp\Helper\SplFileInfo

Returns

boolean

Joins two file or directory paths.

join(string|null $lhs, string $rhs) : string
Static

If the left path is null, returns the right path, making the left path optional (see https://stackoverflow.com/q/1091107).

Parameters

$lhs

stringnull

$rhs

string

Returns

string

Removes a directory recursively.

removeDirectory(string $path) : boolean
Static

Parameters

$path

string

Returns

boolean

Resolves a relative file or directory path.

resolve(string $fileName) : string
Static

This only works for unambiguous paths not depending on the working directory (e.g. ../test can not be resolved) (see https://stackoverflow.com/q/20522605).

Parameters

$fileName

string

Returns

string

Builds a path referring to the root directory from a relative path.

rootPath(string $directory) 
Static

Parameters

$directory

string

return string

Strips a base from a file or directory path.

stripBase(string $path, string $base = null) : string
Static

If no base is supplied, the working directory is used.

Parameters

$path

string

$base

string

Returns

string