eloquent/pathogen API
Class

Eloquent\Pathogen\Unix\RelativeUnixPath

class RelativeUnixPath extends RelativePath implements RelativeFileSystemPathInterface, RelativeUnixPathInterface

Represents a relative Unix path.

Constants

ATOM_SEPARATOR

The character used to separate path atoms.

EXTENSION_SEPARATOR

The character used to separate path name atoms.

PARENT_ATOM

The atom used to represent 'parent'.

SELF_ATOM

The atom used to represent 'self'.

Methods

static RelativePathInterface fromString(string $path)

Creates a new relative path instance from its string representation.

from RelativePath
static RelativePathInterface fromAtoms(mixed<string> $atoms, boolean|null $hasTrailingSeparator = null)

Creates a new relative path from a set of path atoms.

from RelativePath
AbsolutePathInterface toAbsolute()

Get an absolute version of this path.

from RelativePath
RelativePathInterface toRelative()

Get a relative version of this path.

from RelativePath
boolean isSelf()

Determine whether this path is the self path.

from RelativePath
AbsolutePathInterface resolveAgainst(AbsolutePathInterface $basePath)

Resolve this path against the supplied path.

from RelativePath

Details

in RelativePath at line 27
static public RelativePathInterface fromString(string $path)

Creates a new relative path instance from its string representation.

Parameters

string $path The string representation of the relative path.

Return Value

RelativePathInterface The newly created relative path instance.

Exceptions

NonRelativePathException If the supplied string represents a non-relative path.

in RelativePath at line 47
static public RelativePathInterface fromAtoms(mixed<string> $atoms, boolean|null $hasTrailingSeparator = null)

Creates a new relative path from a set of path atoms.

Parameters

mixed<string> $atoms The path atoms.
boolean|null $hasTrailingSeparator True if the path has a trailing separator.

Return Value

RelativePathInterface The newly created relative path.

Exceptions

InvalidPathAtomExceptionInterface If any of the supplied atoms are invalid.
InvalidPathStateException If the supplied arguments would produce an invalid path.

in RelativePath at line 67
public AbsolutePathInterface toAbsolute()

Get an absolute version of this path.

If this path is relative, a new absolute path with equivalent atoms will be returned. Otherwise, this path will be retured unaltered.

Return Value

AbsolutePathInterface An absolute version of this path.

Exceptions

InvalidPathStateException If absolute conversion is not possible for this path.

in RelativePath at line 85
public RelativePathInterface toRelative()

Get a relative version of this path.

If this path is absolute, a new relative path with equivalent atoms will be returned. Otherwise, this path will be retured unaltered.

Return Value

RelativePathInterface A relative version of this path.

Exceptions

EmptyPathException If this path has no atoms.

in RelativePath at line 100
public boolean isSelf()

Determine whether this path is the self path.

The self path is a relative path with a single self atom (i.e. a dot '.').

Return Value

boolean True if this path is the self path.

in RelativePath at line 114
public AbsolutePathInterface resolveAgainst(AbsolutePathInterface $basePath)

Resolve this path against the supplied path.

Parameters

AbsolutePathInterface $basePath The path to resolve against.

Return Value

AbsolutePathInterface The resolved path.