eloquent/pathogen API
Class

Eloquent\Pathogen\Windows\AbsoluteWindowsPath

class AbsoluteWindowsPath extends AbsolutePath implements AbsoluteFileSystemPathInterface, AbsoluteWindowsPathInterface

Represents an absolute Windows 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 AbsolutePathInterface fromString(string $path)

Creates a new absolute path from its string representation.

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

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

from AbsolutePath
string string()

Generate a string representation of this path.

PathInterface joinTrailingSlash()

Adds a trailing slash to this path.

from AbsolutePath
AbsolutePathInterface toAbsolute()

Get an absolute version of this path.

from AbsolutePath
RelativePathInterface toRelative()

Get a relative version of this path.

boolean isRoot()

Determine whether this path is the root path.

from AbsolutePath
boolean isParentOf(AbsolutePathInterface $path)

Determine if this path is the direct parent of the supplied path.

boolean isAncestorOf(AbsolutePathInterface $path)

Determine if this path is an ancestor of the supplied path.

RelativePathInterface relativeTo(AbsolutePathInterface $path)

Determine the shortest path from the supplied path to this path.

AbsolutePathInterface resolve(PathInterface $path)

Resolve the supplied path against this path.

from AbsolutePath
static AbsoluteWindowsPathInterface fromDriveAndAtoms(string $drive, mixed<string> $atoms, boolean|null $hasTrailingSeparator = null)

Creates a new absolute Windows path from a set of path atoms and a drive specifier.

__construct(string $drive, mixed<string> $atoms, boolean|null $hasTrailingSeparator = null)

Construct a new path instance.

string|null drive()

Get this path's drive specifier.

boolean hasDrive()

Determine whether this path has a drive specifier.

boolean matchesDrive(string|null $drive)

Returns true if this path's drive specifier is equal to the supplied drive specifier.

boolean matchesDriveOrNull(string|null $drive)

Returns true if this path's drive specifier matches the supplied drive specifier, or if either drive specifier is null.

string|null joinDrive($drive)

Joins the supplied drive specifier to this path.

PathInterface join(RelativePathInterface $path)

Joins the supplied path to this path.

Details

in AbsolutePath at line 27
static public AbsolutePathInterface fromString(string $path)

Creates a new absolute path from its string representation.

Parameters

string $path The string representation of the absolute path.

Return Value

AbsolutePathInterface The newly created absolute path.

Exceptions

NonAbsolutePathException If the supplied string represents a non-absolute path.

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

Creates a new absolute 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

AbsolutePathInterface The newly created absolute path.

Exceptions

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

at line 223
public string string()

Generate a string representation of this path.

Return Value

string A string representation of this path.

in AbsolutePath at line 73
public PathInterface joinTrailingSlash()

Adds a trailing slash to this path.

Return Value

PathInterface A new path instance with a trailing slash suffixed to this path.

in AbsolutePath at line 91
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.

at line 268
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 AbsolutePath at line 123
public boolean isRoot()

Determine whether this path is the root path.

The root path is an absolute path with no atoms.

Return Value

boolean True if this path is the root path.

at line 172
public boolean isParentOf(AbsolutePathInterface $path)

Determine if this path is the direct parent of the supplied path.

Parameters

AbsolutePathInterface $path The child path.

Return Value

boolean True if this path is the direct parent of the supplied path.

at line 188
public boolean isAncestorOf(AbsolutePathInterface $path)

Determine if this path is an ancestor of the supplied path.

Parameters

AbsolutePathInterface $path The child path.

Return Value

boolean True if this path is an ancestor of the supplied path.

at line 207
public RelativePathInterface relativeTo(AbsolutePathInterface $path)

Determine the shortest path from the supplied path to this path.

For example, given path A equal to '/foo/bar', and path B equal to '/foo/baz', A relative to B would be '../bar'.

Parameters

AbsolutePathInterface $path The path that the generated path will be relative to.

Return Value

RelativePathInterface A relative path from the supplied path to this path.

in AbsolutePath at line 207
public AbsolutePathInterface resolve(PathInterface $path)

Resolve the supplied path against this path.

Parameters

PathInterface $path The path to resolve.

Return Value

AbsolutePathInterface The resolved path.

at line 44
static public AbsoluteWindowsPathInterface fromDriveAndAtoms(string $drive, mixed<string> $atoms, boolean|null $hasTrailingSeparator = null)

Creates a new absolute Windows path from a set of path atoms and a drive specifier.

Parameters

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

Return Value

AbsoluteWindowsPathInterface The newly created path instance.

Exceptions

InvalidPathAtomExceptionInterface If any of the supplied atoms are invalid.

at line 68
public __construct(string $drive, mixed<string> $atoms, boolean|null $hasTrailingSeparator = null)

Construct a new path instance.

Parameters

string $drive The drive specifier, or null if the path has no drive specifier.
mixed<string> $atoms The path atoms.
boolean|null $hasTrailingSeparator True if this path has a trailing separator.

Exceptions

InvalidDriveSpecifierException If the drive specifier is invalid.
InvalidPathAtomExceptionInterface If any of the supplied path atoms are invalid.

at line 87
public string|null drive()

Get this path's drive specifier.

Absolute Windows paths always have a drive specifier, and will never return null for this method.

Return Value

string|null The drive specifier, or null if this path does not have a drive specifier.

at line 100
public boolean hasDrive()

Determine whether this path has a drive specifier.

Absolute Windows paths always have a drive specifier, and will always return true for this method.

Return Value

boolean True is this path has a drive specifier.

at line 115
public boolean matchesDrive(string|null $drive)

Returns true if this path's drive specifier is equal to the supplied drive specifier.

This method is not case sensitive.

Parameters

string|null $drive The driver specifier to compare to.

Return Value

boolean True if the drive specifiers are equal.

at line 130
public boolean matchesDriveOrNull(string|null $drive)

Returns true if this path's drive specifier matches the supplied drive specifier, or if either drive specifier is null.

This method is not case sensitive.

Parameters

string|null $drive The driver specifier to compare to.

Return Value

boolean True if the drive specifiers match, or either drive specifier is null.

at line 142
public string|null joinDrive($drive)

Joins the supplied drive specifier to this path.

Parameters

$drive

Return Value

string|null $drive The drive specifier to use, or null to remove the drive specifier.

at line 241
public PathInterface join(RelativePathInterface $path)

Joins the supplied path to this path.

Parameters

RelativePathInterface $path The path whose atoms should be joined to this path.

Return Value

PathInterface A new path with the supplied path suffixed to this path.

Exceptions

DriveMismatchException If the supplied path has a drive that does not match this path's drive.