interface FileSystemPathInterface implements PathInterface
The interface implemented by all file system paths.
Methods
array<integer,string> |
atoms()
Get the atoms of this path. |
from PathInterface |
string |
atomAt(integer $index)
Get a single path atom by index. |
from PathInterface |
mixed |
atomAtDefault(integer $index, mixed $default = null)
Get a single path atom by index, falling back to a default if the index is undefined. |
from PathInterface |
array<integer,string> |
sliceAtoms(integer $index, integer|null $length = null)
Get a subset of the atoms of this path. |
from PathInterface |
boolean |
hasAtoms()
Determine if this path has any atoms. |
from PathInterface |
boolean |
hasTrailingSeparator()
Determine if this path has a trailing separator. |
from PathInterface |
string |
string()
Generate a string representation of this path. |
from PathInterface |
string |
__toString()
Generate a string representation of this path. |
from PathInterface |
string |
name()
Get this path's name. |
from PathInterface |
array<integer,string> |
nameAtoms()
Get this path's name atoms. |
from PathInterface |
string |
nameAtomAt(integer $index)
Get a single path name atom by index. |
from PathInterface |
mixed |
nameAtomAtDefault(integer $index, mixed $default = null)
Get a single path name atom by index, falling back to a default if the index is undefined. |
from PathInterface |
array<integer,string> |
sliceNameAtoms(integer $index, integer|null $length = null)
Get a subset of this path's name atoms. |
from PathInterface |
string |
nameWithoutExtension()
Get this path's name, excluding the last extension. |
from PathInterface |
string |
namePrefix()
Get this path's name, excluding all extensions. |
from PathInterface |
string|null |
nameSuffix()
Get all of this path's extensions. |
from PathInterface |
string|null |
extension()
Get this path's last extension. |
from PathInterface |
boolean |
hasExtension()
Determine if this path has any extensions. |
from PathInterface |
boolean |
contains(string $needle, boolean|null $caseSensitive = null)
Determine if this path contains a substring. |
from PathInterface |
boolean |
startsWith(string $needle, boolean|null $caseSensitive = null)
Determine if this path starts with a substring. |
from PathInterface |
boolean |
endsWith(string $needle, boolean|null $caseSensitive = null)
Determine if this path ends with a substring. |
from PathInterface |
boolean |
matches(string $pattern, boolean|null $caseSensitive = null, integer|null $flags = null)
Determine if this path matches a wildcard pattern. |
from PathInterface |
boolean |
matchesRegex(string $pattern, array $matches = null, integer|null $flags = null, integer|null $offset = null)
Determine if this path matches a regular expression. |
from PathInterface |
boolean |
nameContains(string $needle, boolean|null $caseSensitive = null)
Determine if this path's name contains a substring. |
from PathInterface |
boolean |
nameStartsWith(string $needle, boolean|null $caseSensitive = null)
Determine if this path's name starts with a substring. |
from PathInterface |
boolean |
nameMatches(string $pattern, boolean|null $caseSensitive = null, integer|null $flags = null)
Determine if this path's name matches a wildcard pattern. |
from PathInterface |
boolean |
nameMatchesRegex(string $pattern, array $matches = null, integer|null $flags = null, integer|null $offset = null)
Determine if this path's name matches a regular expression. |
from PathInterface |
PathInterface |
parent(integer|null $numLevels = null)
Get the parent of this path a specified number of levels up. |
from PathInterface |
PathInterface |
stripTrailingSlash()
Strips the trailing slash from this path. |
from PathInterface |
PathInterface |
stripExtension()
Strips the last extension from this path. |
from PathInterface |
PathInterface |
stripNameSuffix()
Strips all extensions from this path. |
from PathInterface |
PathInterface |
joinAtoms($atom)
Joins one or more atoms to this path. |
from PathInterface |
PathInterface |
joinAtomSequence(mixed<string> $atoms)
Joins a sequence of atoms to this path. |
from PathInterface |
PathInterface |
join(RelativePathInterface $path)
Joins the supplied path to this path. |
from PathInterface |
PathInterface |
joinTrailingSlash()
Adds a trailing slash to this path. |
from PathInterface |
PathInterface |
joinExtensions($extension)
Joins one or more extensions to this path. |
from PathInterface |
PathInterface |
joinExtensionSequence(mixed<string> $extensions)
Joins a sequence of extensions to this path. |
from PathInterface |
PathInterface |
suffixName(string $suffix)
Suffixes this path's name with a supplied string. |
from PathInterface |
PathInterface |
prefixName(string $prefix)
Prefixes this path's name with a supplied string. |
from PathInterface |
PathInterface |
replace(integer $index, mixed<string> $replacement, integer|null $length = null)
Replace a section of this path with the supplied atom sequence. |
from PathInterface |
PathInterface |
replaceName(string $name)
Replace this path's name. |
from PathInterface |
PathInterface |
replaceNameWithoutExtension(string $nameWithoutExtension)
Replace this path's name, but keep the last extension. |
from PathInterface |
PathInterface |
replaceNamePrefix(string $namePrefix)
Replace this path's name, but keep any extensions. |
from PathInterface |
PathInterface |
replaceNameSuffix(string|null $nameSuffix)
Replace all of this path's extensions. |
from PathInterface |
PathInterface |
replaceExtension(string|null $extension)
Replace this path's last extension. |
from PathInterface |
PathInterface |
replaceNameAtoms(integer $index, mixed<string> $replacement, integer|null $length = null)
Replace a section of this path's name with the supplied name atom sequence. |
from PathInterface |
AbsolutePathInterface |
toAbsolute()
Get an absolute version of this path. |
from PathInterface |
RelativePathInterface |
toRelative()
Get a relative version of this path. |
from PathInterface |
PathInterface |
normalize()
Normalize this path to its most canonical form. |
from PathInterface |
Details
in PathInterface at line 26
public array<integer,string>
atoms()
Get the atoms of this path.
For example, the path '/foo/bar' has the atoms 'foo' and 'bar'.
in PathInterface at line 36
public string
atomAt(integer $index)
Get a single path atom by index.
in PathInterface at line 47
public mixed
atomAtDefault(integer $index, mixed $default = null)
Get a single path atom by index, falling back to a default if the index is undefined.
in PathInterface at line 57
public array<integer,string>
sliceAtoms(integer $index, integer|null $length = null)
Get a subset of the atoms of this path.
in PathInterface at line 64
public boolean
hasAtoms()
Determine if this path has any atoms.
in PathInterface at line 71
public boolean
hasTrailingSeparator()
Determine if this path has a trailing separator.
in PathInterface at line 78
public string
string()
Generate a string representation of this path.
in PathInterface at line 85
public string
__toString()
Generate a string representation of this path.
in PathInterface at line 92
public string
name()
Get this path's name.
in PathInterface at line 101
public array<integer,string>
nameAtoms()
Get this path's name atoms.
For example, the path name 'foo.bar' has the atoms 'foo' and 'bar'.
in PathInterface at line 111
public string
nameAtomAt(integer $index)
Get a single path name atom by index.
in PathInterface at line 122
public mixed
nameAtomAtDefault(integer $index, mixed $default = null)
Get a single path name atom by index, falling back to a default if the index is undefined.
in PathInterface at line 132
public array<integer,string>
sliceNameAtoms(integer $index, integer|null $length = null)
Get a subset of this path's name atoms.
in PathInterface at line 139
public string
nameWithoutExtension()
Get this path's name, excluding the last extension.
in PathInterface at line 146
public string
namePrefix()
Get this path's name, excluding all extensions.
in PathInterface at line 153
public string|null
nameSuffix()
Get all of this path's extensions.
in PathInterface at line 160
public string|null
extension()
Get this path's last extension.
in PathInterface at line 167
public boolean
hasExtension()
Determine if this path has any extensions.
in PathInterface at line 177
public boolean
contains(string $needle, boolean|null $caseSensitive = null)
Determine if this path contains a substring.
in PathInterface at line 187
public boolean
startsWith(string $needle, boolean|null $caseSensitive = null)
Determine if this path starts with a substring.
in PathInterface at line 197
public boolean
endsWith(string $needle, boolean|null $caseSensitive = null)
Determine if this path ends with a substring.
in PathInterface at line 208
public boolean
matches(string $pattern, boolean|null $caseSensitive = null, integer|null $flags = null)
Determine if this path matches a wildcard pattern.
in PathInterface at line 220
public boolean
matchesRegex(string $pattern, array $matches = null, integer|null $flags = null, integer|null $offset = null)
Determine if this path matches a regular expression.
in PathInterface at line 235
public boolean
nameContains(string $needle, boolean|null $caseSensitive = null)
Determine if this path's name contains a substring.
in PathInterface at line 245
public boolean
nameStartsWith(string $needle, boolean|null $caseSensitive = null)
Determine if this path's name starts with a substring.
in PathInterface at line 256
public boolean
nameMatches(string $pattern, boolean|null $caseSensitive = null, integer|null $flags = null)
Determine if this path's name matches a wildcard pattern.
in PathInterface at line 268
public boolean
nameMatchesRegex(string $pattern, array $matches = null, integer|null $flags = null, integer|null $offset = null)
Determine if this path's name matches a regular expression.
in PathInterface at line 282
public PathInterface
parent(integer|null $numLevels = null)
Get the parent of this path a specified number of levels up.
in PathInterface at line 289
public PathInterface
stripTrailingSlash()
Strips the trailing slash from this path.
in PathInterface at line 296
public PathInterface
stripExtension()
Strips the last extension from this path.
in PathInterface at line 303
public PathInterface
stripNameSuffix()
Strips all extensions from this path.
in PathInterface at line 314
public PathInterface
joinAtoms($atom)
Joins one or more atoms to this path.
in PathInterface at line 324
public PathInterface
joinAtomSequence(mixed<string> $atoms)
Joins a sequence of atoms to this path.
in PathInterface at line 333
public PathInterface
join(RelativePathInterface $path)
Joins the supplied path to this path.
in PathInterface at line 340
public PathInterface
joinTrailingSlash()
Adds a trailing slash to this path.
in PathInterface at line 351
public PathInterface
joinExtensions($extension)
Joins one or more extensions to this path.
in PathInterface at line 361
public PathInterface
joinExtensionSequence(mixed<string> $extensions)
Joins a sequence of extensions to this path.
in PathInterface at line 371
public PathInterface
suffixName(string $suffix)
Suffixes this path's name with a supplied string.
in PathInterface at line 381
public PathInterface
prefixName(string $prefix)
Prefixes this path's name with a supplied string.
in PathInterface at line 392
public PathInterface
replace(integer $index, mixed<string> $replacement, integer|null $length = null)
Replace a section of this path with the supplied atom sequence.
in PathInterface at line 401
public PathInterface
replaceName(string $name)
Replace this path's name.
in PathInterface at line 410
public PathInterface
replaceNameWithoutExtension(string $nameWithoutExtension)
Replace this path's name, but keep the last extension.
in PathInterface at line 419
public PathInterface
replaceNamePrefix(string $namePrefix)
Replace this path's name, but keep any extensions.
in PathInterface at line 428
public PathInterface
replaceNameSuffix(string|null $nameSuffix)
Replace all of this path's extensions.
in PathInterface at line 437
public PathInterface
replaceExtension(string|null $extension)
Replace this path's last extension.
in PathInterface at line 449
public PathInterface
replaceNameAtoms(integer $index, mixed<string> $replacement, integer|null $length = null)
Replace a section of this path's name with the supplied name atom sequence.
in PathInterface at line 460
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 PathInterface at line 471
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.
in PathInterface at line 478
public PathInterface
normalize()
Normalize this path to its most canonical form.