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