FileLocator
in package
implements
FileLocatorInterface
FileLocator uses an array of pre-defined paths to find files.
Tags
Table of Contents
Interfaces
Properties
- $paths : mixed
Methods
- __construct() : mixed
- locate() : string|array<string|int, mixed>
- Returns a full path for a given file name.
- isAbsolutePath() : bool
- Returns whether the file path is an absolute path.
Properties
$paths
protected
mixed
$paths
Methods
__construct()
public
__construct([string|array<string|int, string> $paths = [] ]) : mixed
Parameters
- $paths : string|array<string|int, string> = []
-
A path or an array of paths where to look for resources
locate()
Returns a full path for a given file name.
public
locate(string $name[, string $currentPath = null ][, bool $first = true ]) : string|array<string|int, mixed>
Parameters
- $name : string
-
The file name to locate
- $currentPath : string = null
-
The current path
- $first : bool = true
-
Whether to return the first occurrence or an array of filenames
Return values
string|array<string|int, mixed> —The full path to the file or an array of file paths
isAbsolutePath()
Returns whether the file path is an absolute path.
private
isAbsolutePath(string $file) : bool
Parameters
- $file : string