Trait PathScriptTrait
Path-handling utilities
Requirements:
- DIRECTORY_SEPARATORS
class constant.
- DEFAULT_BASENAME
class constant.
- self::parseAsArray()
Methods summary
abstract public
string|null
|
#
basePath( )
Retrieve the base path.
Returns
string|null
|
public
string[]
|
#
processMultiplePaths( string|string[] $paths )
Process multiple paths.
Parameters
- $paths
- One or many paths to scan.
Returns
string[]
Throws
InvalidArgumentException If the paths are invalid.
|
public
boolean
|
#
pathExists( string $path )
Determine if the path exists.
Determine if the path exists.
Parameters
- $path
- Path to the file or directory.
Returns
boolean Returns TRUE if the path exists.
Throws
InvalidArgumentException If the path is invalid.
|
public
string
|
#
filterPath( string $path, string|null $trim = null )
Filter the given path.
Trims leading and trailing directory paths
Parameters
- $path
- Path to the file or directory.
- $trim
- The characters to strip from the $path.
Returns
string Returns the filtered path.
Throws
InvalidArgumentException If the path is invalid.
|
public
string
|
#
filterWritablePath( string $path, string|null $name = null )
Filter the given path to be writable.
Filter the given path to be writable.
Parameters
- $path
- A writable path to a file or directory.
- $name
- The target file name.
Returns
string Returns the filtered path.
Throws
InvalidArgumentException If the path is invalid.
|
public
array
|
#
globRecursive( string $pattern, integer $flags = 0 )
Recursively find pathnames matching a pattern.
Recursively find pathnames matching a pattern.
Parameters
- $pattern
- The search pattern.
- $flags
- Bitmask of glob() options.
Returns
array
See
http://in.php.net/manual/en/function.glob.php#106595
|
Properties summary
protected static
array
|
$globCache
The cache of globbed paths.
The cache of globbed paths.
|
|