Path
in package
Uses
AbsolutePathFromCurrentDirTrait
The inevitable reusable static helper
Table of Contents
- $factory : PathFactory
- addTrailingSlash() : string
- Idempotent: Ensure there is exactly one trailing slash
- fromCurrentDir() : AbsolutePathInterface
- fromString() : PathInterface
- hasLeadingAnchorDot() : bool
- isAbsolutePath() : bool
- levelUp() : string
- Move up by X levels
- normalize() : string
- removeTrailingSlash() : string
Properties
$factory
public
static PathFactory
$factory
Methods
addTrailingSlash()
Idempotent: Ensure there is exactly one trailing slash
public
static addTrailingSlash(string|Stringable $path) : string
Parameters
- $path : string|Stringable
Return values
string —fromCurrentDir()
public
static fromCurrentDir() : AbsolutePathInterface
Return values
AbsolutePathInterface —fromString()
public
static fromString(string|Stringable $path) : PathInterface
Parameters
- $path : string|Stringable
Return values
PathInterface —hasLeadingAnchorDot()
public
static hasLeadingAnchorDot(string|Stringable $path) : bool
Parameters
- $path : string|Stringable
Return values
bool —isAbsolutePath()
public
static isAbsolutePath(string|Stringable $path) : bool
Parameters
- $path : string|Stringable
Return values
bool —levelUp()
Move up by X levels
public
static levelUp(string|Stringable $path[, int $levels = 1 ]) : string
Implicitly normalizes a path before moving Collision with absolute root / means end. Collision with relative top element means prepend ..
Parameters
- $path : string|Stringable
- $levels : int = 1
Return values
string —normalize()
public
static normalize(string|Stringable $path) : string
Parameters
- $path : string|Stringable
Return values
string —removeTrailingSlash()
public
static removeTrailingSlash(string|Stringable $path) : string
Parameters
- $path : string|Stringable