Methods summary
public static
string
|
#
root( )
Returns a path denoting the root, '/'.
Returns a path denoting the root, '/'.
Returns
string
|
public static
string
|
#
childPath( string $path, string $name )
Returns a new path denoting a specified child element of the element denoted by this path.
Returns a new path denoting a specified child element of the element denoted by this path.
For instance, Path::childPath('/an/example/', 'child') is equal to '/an/example/child'.
Parameters
- $path
- path.
- $name
- name of the child element.
Returns
string A path denoting the child element.
Throws
|
public static
string
|
#
parentPath( string $path )
Returns a new path denoting the parent element of the element denoted by this path.
Returns a new path denoting the parent element of the element denoted by this path.
For instance, Path::parentPath('/an/example/') is equal to '/an'.
Parameters
Returns
string A new path denoting the parent element.
Throws
|
public static
array
|
#
ancestors( string $path )
Returns all the ancestors to a path, starting with the closest.
Returns all the ancestors to a path, starting with the closest.
For instance, Path::ancestors('/an/example/path') will return an indexed array containing
the paths: '/an/example', '/an' and '/' in that order.
Parameters
Returns
array A list of ancestor path strings.
Throws
|
public static
string
|
#
simpleName( string $path )
Returns the simple name of the element denoted by this path.
Returns the simple name of the element denoted by this path.
For instance, Path::simpleName('/an/example') becomes 'example'.
Parameters
Returns
string
|
public static
boolean
|
#
isRoot( string $path )
True if this path denotes the root '/', false otherwise.
True if this path denotes the root '/', false otherwise.
Parameters
Returns
boolean
|
public static
boolean
|
#
hasParent( string $path )
True if this path has a parent path.
True if this path has a parent path.
Parameters
Returns
boolean
|
public static
integer
|
#
length( string $path )
Returns the number of components in a path.
Returns the number of components in a path.
The root (/) has length 1.
Parameters
Returns
integer
|
public static
string
|
#
ancestor( string $path, integer $length )
Returns the ancestor of length $length of a path.
Returns the ancestor of length $length of a path.
For instance, Path::ancestor('/a/b/c/d', 3) returns /a/b,
since /a/b is the ancestor of /a/b/c/d with length 3.
Parameters
Returns
string
|
public static
string
|
#
endpath( string $path, integer $start )
Returns an end path of a path.
Returns an end path of a path.
For instance, Path::endpath('/a/b/c/d', 2) returns the relative
path b/c/d, since the prefix /a of length 2 is cut.
Parameters
Returns
string
Throws
|
public static
string
|
#
descendant( string $path, string $endpath )
Returns a descendant of a path.
Returns a descendant of a path.
For instance, Path::descendant('/a/b', 'c/d') returns the path '/a/b/c/d'.
Parameters
Returns
string
|
public static
boolean
|
#
hasAncestor( string $path, string $ancestor )
Returns true if this path has an ancestor as specified by the $ancestor argument. Otherwise, returns false.
Returns true if this path has an ancestor as specified by the $ancestor argument. Otherwise, returns false.
For instance, Path::hasAncestor('/a/b/c', '/a') returns true,
while Path::hasAncestor('/a/b', '/c') return false.
Parameters
Returns
boolean
|