class Repository extends Repository (View source)

Properties

protected LoaderInterface $loader

The loader implementation.

protected SaverInterface $saver

The saver implementation.

protected string $environment

The current environment.

protected array $items

All of the configuration items.

protected array $packages

All of the registered packages.

protected array $afterLoad

The after load callbacks for namespaces.

protected array $parsed

A cache of the parsed items.

Methods

__construct(LoaderInterface $loader, SaverInterface $saver, string $environment)

Create a new configuration repository.

bool
has(string $key)

Determine if the given configuration value exists.

bool
hasGroup(string $key)

Determine if a configuration group exists.

mixed
get(string $key, mixed $default = null)

Get the specified configuration value.

set(string $key, mixed $value = null)

Set a given configuration value.

bool
save(string $key, mixed $value)

Save a key.

clear(string $key)

Clear specific key.

clearCache()

Clear cached items.

clearNamespace(string $namespace)

Clear a namespace (Note: this deletes items permanently).

package(Package $package, string|null $hint = null, string|null $namespace = null)

Register a package for cascading configuration.

afterLoading(string $namespace, Closure $callback)

Register an after load callback for a given namespace.

addNamespace(string $namespace, string $hint)

Add a new namespace to the loader.

array
getNamespaces()

Returns all registered namespaces with the config loader.

getLoader()

Get the loader implementation.

setLoader(LoaderInterface $loader)

Set the loader implementation.

getSaver()

Get the saver implementation.

setSaver(SaverInterface $saver)

Set the saver instance.

string
getEnvironment()

Get the current configuration environment.

array
getAfterLoadCallbacks()

Get the after load callback array.

array
getItems()

Get all of the configuration items.

array
parseKey(string $key)

Parse a key into namespace, group, and item.

setParsedKey(string $key, array $parsed)

Set the parsed value of a key.

mixed
withKey(string $key, mixed $value, callable $callable)

Execute a callable using a specific key value.

load(string $group, string $namespace, string $collection)

Load the configuration group for the key.

array
callAfterLoad(string $namespace, string $group, array $items)

Call the after load callback for a namespace.

array
parseNamespacedSegments(string $key)

Parse an array of namespaced segments.

array
parsePackageSegments(string $key, string $namespace, string $item)

No description

string
getPackageNamespace(string|Package|Package $package, string $namespace)

Get the configuration namespace for a package.

string
getCollection(string $group, string $namespace = null)

Get the collection identifier.

array
parseBasicSegments(array $segments)

Parse an array of basic segments.

Details

__construct(LoaderInterface $loader, SaverInterface $saver, string $environment)

Create a new configuration repository.

Parameters

LoaderInterface $loader
SaverInterface $saver
string $environment

bool has(string $key)

Determine if the given configuration value exists.

Parameters

string $key

Return Value

bool

bool hasGroup(string $key)

Determine if a configuration group exists.

Parameters

string $key

Return Value

bool

mixed get(string $key, mixed $default = null)

Get the specified configuration value.

Parameters

string $key
mixed $default

Return Value

mixed

set(string $key, mixed $value = null)

Set a given configuration value.

Parameters

string $key
mixed $value

bool save(string $key, mixed $value)

Save a key.

Parameters

string $key
mixed $value

Return Value

bool

clear(string $key)

Clear specific key.

Parameters

string $key

clearCache()

Clear cached items.

clearNamespace(string $namespace)

Clear a namespace (Note: this deletes items permanently).

Parameters

string $namespace

package(Package $package, string|null $hint = null, string|null $namespace = null)

Register a package for cascading configuration.

Parameters

Package $package
string|null $hint
string|null $namespace

afterLoading(string $namespace, Closure $callback)

Register an after load callback for a given namespace.

Parameters

string $namespace
Closure $callback

addNamespace(string $namespace, string $hint)

Add a new namespace to the loader.

Parameters

string $namespace
string $hint

array getNamespaces()

Returns all registered namespaces with the config loader.

Return Value

array

LoaderInterface getLoader()

Get the loader implementation.

Return Value

LoaderInterface

setLoader(LoaderInterface $loader)

Set the loader implementation.

Parameters

LoaderInterface $loader

SaverInterface getSaver()

Get the saver implementation.

Return Value

SaverInterface

setSaver(SaverInterface $saver)

Set the saver instance.

Parameters

SaverInterface $saver

string getEnvironment()

Get the current configuration environment.

Return Value

string

array getAfterLoadCallbacks()

Get the after load callback array.

Return Value

array

array getItems()

Get all of the configuration items.

Return Value

array

array parseKey(string $key)

Parse a key into namespace, group, and item.

Parameters

string $key

Return Value

array

setParsedKey(string $key, array $parsed)

Set the parsed value of a key.

Parameters

string $key
array $parsed

mixed withKey(string $key, mixed $value, callable $callable)

Execute a callable using a specific key value.

Parameters

string $key
mixed $value
callable $callable

Return Value

mixed

returns the result of $callable

protected load(string $group, string $namespace, string $collection)

Load the configuration group for the key.

Parameters

string $group
string $namespace
string $collection

protected array callAfterLoad(string $namespace, string $group, array $items)

Call the after load callback for a namespace.

Parameters

string $namespace
string $group
array $items

Return Value

array

protected array parseNamespacedSegments(string $key)

Parse an array of namespaced segments.

Parameters

string $key

Return Value

array

protected array parsePackageSegments(string $key, string $namespace, string $item)

No description

Parameters

string $key
string $namespace
string $item

Return Value

array

protected string getPackageNamespace(string|Package|Package $package, string $namespace)

Get the configuration namespace for a package.

Parameters

string|Package|Package $package
string $namespace

Return Value

string

protected string getCollection(string $group, string $namespace = null)

Get the collection identifier.

Parameters

string $group
string $namespace

Return Value

string

protected array parseBasicSegments(array $segments)

Parse an array of basic segments.

Parameters

array $segments

Return Value

array