class RelativeWindowsPath extends RelativePath implements RelativeFileSystemPathInterface, RelativeWindowsPathInterface
Represents a relative 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 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. |
|
RelativePathInterface |
toRelative()
Get a relative version of this path. |
from RelativePath |
boolean |
isSelf()
Determine whether this path is the self path. |
|
AbsolutePathInterface |
resolveAgainst(AbsolutePathInterface $basePath)
Resolve this path against the supplied path. |
from RelativePath |
static WindowsPathInterface |
fromDriveAndAtoms(mixed<string> $atoms, string|null $drive = null, boolean|null $isAnchored = null, boolean|null $hasTrailingSeparator = null)
Creates a new relative Windows path from a set of path atoms and a drive specifier. |
|
__construct(mixed<string> $atoms, string|null $drive = null, boolean|null $isAnchored = null, boolean|null $hasTrailingSeparator = null)
Construct a new relative Windows 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. |
|
boolean |
isAnchored()
Returns true if this path is 'anchored' to the drive root. |
|
string |
string()
Generate a string representation of this path. |
|
PathInterface |
join(RelativePathInterface $path)
Joins the supplied path to this path. |
Details
in RelativePath at line 27
static public RelativePathInterface
fromString(string $path)
Creates a new relative path instance from its string representation.
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.
at line 270
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.
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.
at line 214
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 '.').
in RelativePath at line 114
public AbsolutePathInterface
resolveAgainst(AbsolutePathInterface $basePath)
Resolve this path against the supplied path.
at line 44
static public WindowsPathInterface
fromDriveAndAtoms(mixed<string> $atoms, string|null $drive = null, boolean|null $isAnchored = null, boolean|null $hasTrailingSeparator = null)
Creates a new relative Windows path from a set of path atoms and a drive specifier.
at line 70
public
__construct(mixed<string> $atoms, string|null $drive = null, boolean|null $isAnchored = null, boolean|null $hasTrailingSeparator = null)
Construct a new relative Windows path instance.
at line 107
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.
at line 120
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.
at line 135
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.
at line 150
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.
at line 164
public string|null
joinDrive($drive)
Joins the supplied drive specifier to this path.
at line 199
public boolean
isAnchored()
Returns true if this path is 'anchored' to the drive root.
This is a special case to represent almost-absolute Windows paths where the drive is not present, but the path is still specified as starting from the root of the drive.
For example, the Windows path \path\to\foo
represents the path
C:\path\to\foo
when resolved against the C:
drive.
at line 226
public string
string()
Generate a string representation of this path.
at line 243
public PathInterface
join(RelativePathInterface $path)
Joins the supplied path to this path.