trait NamespacedFileLoaderTrait

Namespaced file loader trait.

Properties

protected string $path Default path.
protected string $extension File extension.
protected array $namespaces Namespaces.

Methods

setPath(string $path)

Sets the default path.

setExtension(string $extension)

Sets the extension.

registerNamespace(string $namespace, string $path)

Registers a namespace.

string
getFilePath(string $file, string|null $extension = null, string|null $suffix = null)

Returns the path to the file.

array
getCascadingFilePaths(string $file, string|null $extension = null, string|null $suffix = null)

Returns an array of cascading file paths.

Details

at line 51
setPath(string $path)

Sets the default path.

Parameters

string $path Path

at line 61
setExtension(string $extension)

Sets the extension.

Parameters

string $extension Extension

at line 72
registerNamespace(string $namespace, string $path)

Registers a namespace.

Parameters

string $namespace Namespace name
string $path Namespace path

at line 85
protected string getFilePath(string $file, string|null $extension = null, string|null $suffix = null)

Returns the path to the file.

Parameters

string $file Filename
string|null $extension File extension
string|null $suffix Path suffix

Return Value

string

at line 127
protected array getCascadingFilePaths(string $file, string|null $extension = null, string|null $suffix = null)

Returns an array of cascading file paths.

Parameters

string $file Filename
string|null $extension File extension
string|null $suffix Path suffix

Return Value

array