class MemoryConfigCollection implements MutableConfigCollectionInterface (View source)

Basic mutable config collection stored in memory

Traits

Properties

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

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

protected array $callCache

Call cache for non-trivial config calls including middleware

protected array $metadata
protected array $history
protected bool $trackMetadata

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)

ConfigCollection constructor.

public static 
create()

No description

public
$this
transform(TransformerInterface[] $transformers)

Trigger transformers to load into this store

public
set(string $class, string|null $name, mixed $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
remove(string $class, string|null $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
merge(string $class, string $name, array $value)

Merge a config for a class, or a field on that class

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
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

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)

ConfigCollection constructor.

Parameters

bool $trackMetadata

static MemoryConfigCollection create()

No description

Return Value

MemoryConfigCollection

$this transform(TransformerInterface[] $transformers)

Trigger transformers to load into this store

Parameters

TransformerInterface[] $transformers

Return Value

$this

MutableConfigCollectionInterface set(string $class, string|null $name, mixed $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|null $name
mixed $data
array $metadata

Return Value

MutableConfigCollectionInterface

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

MutableConfigCollectionInterface remove(string $class, string|null $name = null)

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

Parameters

string $class
string|null $name

Return Value

MutableConfigCollectionInterface

removeAll()

Delete all entries

array getAll()

Get complete config (excludes middleware-applied config)

Return Value

array

MutableConfigCollectionInterface merge(string $class, string $name, array $value)

Merge a config for a class, or a field on that class

Parameters

string $class
string $name
array $value

Return Value

MutableConfigCollectionInterface

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

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