class DeltaConfigCollection extends MemoryConfigCollection (View source)

Applies config modifications as a set of deltas on top of the middleware, instead of as modifications to the underlying list.

Traits

Constants

REMOVE

Remove delta

MERGE

Merge delta

CLEAR

Remove all config for this class

REPLACE

Replace all config for this class

SET

Set delta

Properties

protected Middleware[] $middlewares from  MiddlewareAware
protected array $config

Stores a list of key/value config prior to middleware being applied

from  MemoryConfigCollection
protected array $callCache

Call cache for non-trivial config calls including middleware

from  MemoryConfigCollection
protected array $metadata from  MemoryConfigCollection
protected array $history from  MemoryConfigCollection
protected bool $trackMetadata from  MemoryConfigCollection
protected DeltaMiddleware $deltaMiddleware
protected array $deltas

List of deltas keyed by class

protected bool $deltaReset

True if removeAll() is applied

Methods

public
getMiddlewares()

No description

public
$this
setMiddlewares(Middleware[] $middlewares)

No description

public
$this
addMiddleware(Middleware $middleware)

No description

protected
array
callMiddleware(string $class, int|bool $excludeMiddleware, callable $last)

Call middleware to get decorated class config

public
__construct(bool $trackMetadata = false, int $middlewareFlag = 0)

Construct a delta collection

public static 
create()

No description

public
$this
transform(TransformerInterface[] $transformers)

Trigger transformers to load into this store

public
$this
set(string $class, string $name, $data, array $metadata = [])

Sets config for a given field.

public
mixed
get(string $class, string $name = null, int|true $excludeMiddleware = 0)

Fetches value for a class, or a property on that class

public
void
checkForDeprecatedConfig($class, $name)

No description

protected
array
getClassConfig(string $class, int|true $excludeMiddleware = 0)

Retrieve config for an entire class

public
bool
exists(string $class, string $name = null, int|true $excludeMiddleware = 0)

Checks to see if a config item exists, or a property on that class

public
$this
remove(string $class, string $name = null)

Remove config for a given class, or field on that class

public
removeAll()

Delete all entries

public
array
getAll()

Get complete config (excludes middleware-applied config)

public
$this
update(string $class, string $name, mixed $value) deprecated

No description

public
$this
merge(string $class, string $name, mixed $value)

No description

public
array
getMetadata()

Returns the entire metadata

public
getHistory()

No description

protected
array
getSerializedMembers()

Get list of serialized properties

public
array
__serialize()

No description

public
void
__unserialize(array $data)

No description

public
string
serialize() deprecated

The __serialize() magic method will be automatically used instead of this

public
unserialize(string $serialized) deprecated

No description

public
nest()

Get nested version of this config, which is normally duplicated version of this config, but could be a subclass.

protected
saveMetadata(string $class, array $metadata)

Save metadata for the given class

public static 
createFromCollection(ConfigCollectionInterface $parent, int $middlewareFlag = 0)

Create a delta collection from a parent collection

public
getDeltaMiddleware()

Get middleware for handling deltas

public
array
getDeltas(string $class)

Get deltas for the given class

public
bool
isDeltaReset(string $class = null)

Check if config should be completely reset before getting config

public
__clone()

No description

protected
postInit()

Restore back-links post-creation or unserialization

protected
clearDeltas(string $class = null, string $key = null)

Remove all deltas for the given class and/or key combination

protected
addDelta(string $class, array $delta)

Push new delta

Details

Middleware[] getMiddlewares()

No description

Return Value

Middleware[]

$this setMiddlewares(Middleware[] $middlewares)

No description

Parameters

Middleware[] $middlewares

Return Value

$this

$this addMiddleware(Middleware $middleware)

No description

Parameters

Middleware $middleware

Return Value

$this

protected array callMiddleware(string $class, int|bool $excludeMiddleware, callable $last)

Call middleware to get decorated class config

Parameters

string $class

Class name to pass

int|bool $excludeMiddleware
callable $last

Last config to call

Return Value

array

Class config with middleware applied

__construct(bool $trackMetadata = false, int $middlewareFlag = 0)

Construct a delta collection

Parameters

bool $trackMetadata
int $middlewareFlag

Flag to use to disable delta middleware (optional)

$this transform(TransformerInterface[] $transformers)

Trigger transformers to load into this store

Parameters

TransformerInterface[] $transformers

Return Value

$this

$this set(string $class, string $name, $data, array $metadata = [])

Sets config for a given field.

Set name to null to set the config for the entire class.

Parameters

string $class
string $name
$data
array $metadata

Return Value

$this

mixed get(string $class, string $name = null, int|true $excludeMiddleware = 0)

Fetches value for a class, or a property on that class

Parameters

string $class

Class name to retrieve config for

string $name

Optional class property to get

int|true $excludeMiddleware

Optional flag of middleware to disable. Passing in true disables all middleware. Can also pass in int flags to specify specific middlewares.

Return Value

mixed

void checkForDeprecatedConfig($class, $name)

No description

Parameters

$class
$name

Return Value

void

protected array getClassConfig(string $class, int|true $excludeMiddleware = 0)

Retrieve config for an entire class

Parameters

string $class

Name of class

int|true $excludeMiddleware

Optional flag of middleware to disable. Passing in true disables all middleware. Can also pass in int flags to specify specific middlewares.

Return Value

array

bool exists(string $class, string $name = null, int|true $excludeMiddleware = 0)

Checks to see if a config item exists, or a property on that class

Parameters

string $class

Class name to check config for

string $name

Optional class property to restrict check to

int|true $excludeMiddleware

Optional flag of middleware to disable. Passing in true disables all middleware. Can also pass in int flags to specify specific middlewares.

Return Value

bool

$this remove(string $class, string $name = null)

Remove config for a given class, or field on that class

Parameters

string $class
string $name

Return Value

$this

removeAll()

Delete all entries

array getAll()

Get complete config (excludes middleware-applied config)

Return Value

array

$this update(string $class, string $name, mixed $value) deprecated

deprecated 1.0.0 Use merge() instead Synonym for merge()

No description

Parameters

string $class
string $name
mixed $value

Return Value

$this

$this merge(string $class, string $name, mixed $value)

No description

Parameters

string $class
string $name
mixed $value

Return Value

$this

array getMetadata()

Returns the entire metadata

Return Value

array

getHistory()

No description

protected array getSerializedMembers()

Get list of serialized properties

Return Value

array

array __serialize()

No description

Return Value

array

void __unserialize(array $data)

No description

Parameters

array $data

Return Value

void

string serialize() deprecated

deprecated 1.12.0 Use __serialize() instead

The __serialize() magic method will be automatically used instead of this

Return Value

string

unserialize(string $serialized) deprecated

deprecated 1.6.0 Use __unserialize() instead

No description

Parameters

string $serialized

ConfigCollectionInterface nest()

Get nested version of this config, which is normally duplicated version of this config, but could be a subclass.

protected saveMetadata(string $class, array $metadata)

Save metadata for the given class

Parameters

string $class
array $metadata

static DeltaConfigCollection createFromCollection(ConfigCollectionInterface $parent, int $middlewareFlag = 0)

Create a delta collection from a parent collection

Parameters

ConfigCollectionInterface $parent
int $middlewareFlag

Flag to use to disable delta middleware (optional)

Return Value

DeltaConfigCollection

DeltaMiddleware getDeltaMiddleware()

Get middleware for handling deltas

Return Value

DeltaMiddleware

array getDeltas(string $class)

Get deltas for the given class

Parameters

string $class

Return Value

array

bool isDeltaReset(string $class = null)

Check if config should be completely reset before getting config

Parameters

string $class

Class to check

Return Value

bool

__clone()

No description

protected postInit()

Restore back-links post-creation or unserialization

protected clearDeltas(string $class = null, string $key = null)

Remove all deltas for the given class and/or key combination

Parameters

string $class

Optional class to limit clear to

string $key

Optional field to limit clear to

protected addDelta(string $class, array $delta)

Push new delta

Parameters

string $class
array $delta