$basePath $basePath : string The base path to prepend to any relative paths to search in. Type string
__construct() __construct(array $data = null) Return new FileLoader object. Parameters array $data The loader's dependencies.
setIdent() setIdent(mixed $ident) : self Set the loader's identifier. Parameters mixed $ident A subset of language identifiers. Throws \InvalidArgumentException If the ident is invalid. Returns self
setBasePath() setBasePath(string $basePath) : self Assign a base path for relative search paths. Parameters string $basePath The base path to use. Throws \InvalidArgumentException If the base path parameter is not a string. Returns self
load() load(string|null $ident = null) : string Returns the content of the first file found in search path. Parameters string|null $ident Optional. A file to search for. Returns string — The file's content or an empty string.
setPaths() setPaths(array<mixed,string> $paths) : self Assign a list of paths. Parameters array<mixed,string> $paths The list of paths to add. Returns self
addPaths() addPaths(array<mixed,string> $paths) : self Append a list of paths. Parameters array<mixed,string> $paths The list of paths to add. Returns self
addPath() addPath(string $path) : self Append a path. Parameters string $path A file or directory path. Throws \InvalidArgumentException If the path does not exist or is invalid. Returns self
prependPath() prependPath(string $path) : self Prepend a path. Parameters string $path A file or directory path. Returns self
resolvePath() resolvePath(string $path) : string Parse a relative path using the base path if needed. Parameters string $path The path to resolve. Throws \InvalidArgumentException If the path is invalid. Returns string
validatePath() validatePath(string $path) : boolean Validate a resolved path. Parameters string $path The path to validate. Returns boolean — Returns TRUE if the path is valid otherwise FALSE.
loadFirstFromSearchPath() loadFirstFromSearchPath(string $filename) : string|null Load the first match from search paths. Parameters string $filename A file to search for. Returns string|null — The matched file's content or an empty string.
firstMatchingFilename() firstMatchingFilename(string $filename) : string Retrieve the first match from search paths. Parameters string $filename A file to search for. Returns string — The full path to the matched file.
allMatchingFilenames() allMatchingFilenames(string $filename) : array Retrieve all matches from search paths. Parameters string $filename A file to search for. Returns array — An array of matches.
loadJsonFile() loadJsonFile(mixed $filename) : array|null Load the contents of a JSON file. Parameters mixed $filename The file path to retrieve. Throws \InvalidArgumentException If a JSON decoding error occurs. Returns array|null