class Loader implements LoaderInterface

Loader.

Traits

Namespaced file loader trait.

Properties

protected string $path Default path. from NamespacedFileLoaderTrait
protected string $extension File extension. from NamespacedFileLoaderTrait
protected array $namespaces Namespaces. from NamespacedFileLoaderTrait
protected FileSystem $fileSystem File system instance.

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.

__construct(FileSystem $fileSystem, string $path)

Constructor.

array
load(string $file, string|null $environment = null)

Loads the configuration file.

Details

setPath(string $path)

Sets the default path.

Parameters

string $path Path

setExtension(string $extension)

Sets the extension.

Parameters

string $extension Extension

registerNamespace(string $namespace, string $path)

Registers a namespace.

Parameters

string $namespace Namespace name
string $path Namespace path

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

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

at line 41
__construct(FileSystem $fileSystem, string $path)

Constructor.

Parameters

FileSystem $fileSystem File system instance
string $path Default path

at line 51
array load(string $file, string|null $environment = null)

Loads the configuration file.

Parameters

string $file Filename
string|null $environment Environment

Return Value

array