abstract class Config (View source)

Constants

UNINHERITED

source options bitmask value - only get configuration set for this specific class, not any of it's parents.

EXCLUDE_EXTRA_SOURCES

NO_DELTAS

Disable all modifications to the config

Methods

public static 
inst()

Get the current active Config instance.

public static 
modify()

Make this config available to be modified

public static 
nest()

Make the newly active Config be a copy of the current active Config instance.

public static 
unnest()

Change the active Config back to the Config instance the current active Config object was copied from.

public static 
forClass(string $class)

Get an accessor that returns results by class by default.

public static 
mixed
withConfig(callable $callback)

Perform the given operation in an isolated config state.

Details

static ConfigCollectionInterface inst()

Get the current active Config instance.

In general use you will use this method to obtain the current Config instance. It assumes the config instance has already been set.

static MutableConfigCollectionInterface modify()

Make this config available to be modified

static ConfigCollectionInterface nest()

Make the newly active Config be a copy of the current active Config instance.

You can then make changes to the configuration by calling update and remove on the new value returned by Config::inst(), and then discard those changes later by calling unnest.

Return Value

ConfigCollectionInterface

Active config

static ConfigCollectionInterface unnest()

Change the active Config back to the Config instance the current active Config object was copied from.

static Config_ForClass forClass(string $class)

Get an accessor that returns results by class by default.

Shouldn't be overridden, since there might be many Config_ForClass instances already held in the wild. Each Config_ForClass instance asks the current_instance of Config for the actual result, so override that instead

Parameters

string $class

Return Value

Config_ForClass

static mixed withConfig(callable $callback)

Perform the given operation in an isolated config state.

On return, the config state will be restored, so any modifications are temporary.

Parameters

callable $callback

Callback to run. Will be passed the nested config state as a parameter

Return Value

mixed

Result of callback