Documentation

FileLoader
in package
implements LoaderInterface

Interfaces, Classes and Traits

LoaderInterface

Table of Contents

$defaultPath  : string
The default configuration path.
$exists  : array<string|int, mixed>
A cache of whether namespaces and groups exists.
$files  : Filesystem
The filesystem instance.
$hints  : array<string|int, mixed>
All of the named path hints.
__construct()  : void
Create a new file configuration loader.
addNamespace()  : void
Add a new namespace to the loader.
cascadePackage()  : array<string|int, mixed>
Apply any cascades to an array of package options.
exists()  : bool
Determine if the given group exists.
getFilesystem()  : Filesystem
Get the Filesystem instance.
getNamespaces()  : array<string|int, mixed>
Returns all registered namespaces with the config loader.
load()  : array<string|int, mixed>
Load the given configuration group.
getPackagePath()  : string
Get the package path for an environment and group.
getPath()  : string|null
Get the configuration path for a namespace.
getRequire()  : mixed
Get a file's contents by requiring it.
mergeEnvironment()  : array<string|int, mixed>
Merge the items in the given file into the items.

Properties

$defaultPath

The default configuration path.

protected string $defaultPath

$exists

A cache of whether namespaces and groups exists.

protected array<string|int, mixed> $exists = []

$hints

All of the named path hints.

protected array<string|int, mixed> $hints = []

Methods

__construct()

Create a new file configuration loader.

public __construct(Filesystem $files, string $defaultPath) : void
Parameters
$files : Filesystem
$defaultPath : string
Return values
void

addNamespace()

Add a new namespace to the loader.

public addNamespace(string $namespace, string $hint) : void
Parameters
$namespace : string
$hint : string
Return values
void

cascadePackage()

Apply any cascades to an array of package options.

public cascadePackage(string $env, string $package, string $group, array<string|int, mixed> $items) : array<string|int, mixed>
Parameters
$env : string
$package : string
$group : string
$items : array<string|int, mixed>
Tags
throws
FileNotFoundException

if file does not exist

Return values
array<string|int, mixed>

exists()

Determine if the given group exists.

public exists(string $group[, string $namespace = null ]) : bool
Parameters
$group : string
$namespace : string = null
Return values
bool

getNamespaces()

Returns all registered namespaces with the config loader.

public getNamespaces() : array<string|int, mixed>
Return values
array<string|int, mixed>

load()

Load the given configuration group.

public load(string $environment, string $group[, string $namespace = null ]) : array<string|int, mixed>
Parameters
$environment : string
$group : string
$namespace : string = null
Tags
throws
FileNotFoundException

if file does not exist

Return values
array<string|int, mixed>

getPackagePath()

Get the package path for an environment and group.

protected getPackagePath(string $package, string $group[, string $env = null ]) : string
Parameters
$package : string
$group : string
$env : string = null
Return values
string

getPath()

Get the configuration path for a namespace.

protected getPath(string $namespace) : string|null
Parameters
$namespace : string
Return values
string|null

getRequire()

Get a file's contents by requiring it.

protected getRequire(string $path) : mixed
Parameters
$path : string
Tags
throws
FileNotFoundException

if file does not exist

Return values
mixed

mergeEnvironment()

Merge the items in the given file into the items.

protected mergeEnvironment(array<string|int, mixed> $items, string $file) : array<string|int, mixed>
Parameters
$items : array<string|int, mixed>
$file : string
Tags
throws
FileNotFoundException

if file does not exist

Return values
array<string|int, mixed>

Search results