class Repository implements ArrayAccess, Repository

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected Closure|null $mutationObserver

The observer invoked after each configuration mutation.

Methods

static void
macro(string $name, callable|object $macro)

Register a custom macro.

static void
mixin(object $mixin, bool $replace = true)

Mix another object into the class.

static bool
hasMacro(string $name)

Check if macro is registered.

static void
flushMacros()

Flush the existing macros.

static mixed
__callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

mixed
__call(string $method, array $parameters)

Dynamically handle calls to the class.

__construct(array $items = [])

Create a new configuration repository.

bool
has(string $key)

Determine if the given configuration value exists.

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

Get the specified configuration value.

array
getMany(array $keys)

Get many configuration values.

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

Get the specified string configuration value.

int
integer(string $key, mixed $default = null)

Get the specified integer configuration value.

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

Get the specified float configuration value.

bool
boolean(string $key, mixed $default = null)

Get the specified boolean configuration value.

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

Get the specified array configuration value.

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

Get the specified configuration value as a Collection.

void
set(array|string $key, mixed $value = null)

Set a given configuration value.

void
prepend(string $key, mixed $value)

Prepend a value onto an array configuration value.

void
push(string $key, mixed $value)

Push a value onto an array configuration value.

array
all()

Get all of the configuration items for the application.

void
replaceItems(array $items)

Replace all configuration items without reporting a mutation.

void
setMutationObserver(Closure $observer)

Set the observer invoked after each configuration mutation.

bool
offsetExists(int|string $offset)

Determine if the given configuration option exists.

mixed
offsetGet(int|string $offset)

Get a configuration option.

void
offsetSet(int|string $offset, mixed $value)

Set a configuration option.

void
offsetUnset(int|string $offset)

Unset a configuration option.

static void
flushState()

Flush all static state.

Details

in Macroable at line 30
static void macro(string $name, callable|object $macro)

Register a custom macro.

Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.

Parameters

string $name
callable|object $macro

Return Value

void

in Macroable at line 44
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

in Macroable at line 61
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 72
static void flushMacros()

Flush the existing macros.

Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.

Return Value

void

in Macroable at line 83
static mixed __callStatic(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

in Macroable at line 108
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

at line 28
__construct(array $items = [])

Create a new configuration repository.

Parameters

array $items

at line 35
bool has(string $key)

Determine if the given configuration value exists.

Parameters

string $key

Return Value

bool

at line 43
mixed get(array|string $key, mixed $default = null)

Get the specified configuration value.

Parameters

array|string $key
mixed $default

Return Value

mixed

at line 55
array getMany(array $keys)

Get many configuration values.

Parameters

array $keys

Return Value

array

at line 76
string string(string $key, mixed $default = null)

Get the specified string configuration value.

Parameters

string $key
mixed $default

Return Value

string

Exceptions

InvalidArgumentException

at line 95
int integer(string $key, mixed $default = null)

Get the specified integer configuration value.

Parameters

string $key
mixed $default

Return Value

int

Exceptions

InvalidArgumentException

at line 114
float float(string $key, mixed $default = null)

Get the specified float configuration value.

Parameters

string $key
mixed $default

Return Value

float

Exceptions

InvalidArgumentException

at line 133
bool boolean(string $key, mixed $default = null)

Get the specified boolean configuration value.

Parameters

string $key
mixed $default

Return Value

bool

Exceptions

InvalidArgumentException

at line 153
array array(string $key, mixed $default = null)

Get the specified array configuration value.

Parameters

string $key
mixed $default

Return Value

array

Exceptions

InvalidArgumentException

at line 173
Collection collection(string $key, mixed $default = null)

Get the specified configuration value as a Collection.

Parameters

string $key
mixed $default

Return Value

Collection

Exceptions

InvalidArgumentException

at line 184
void set(array|string $key, mixed $value = null)

Set a given configuration value.

The config repository is a process-global singleton; per-request mutation races across coroutines and affects every concurrent request.

Parameters

array|string $key
mixed $value

Return Value

void

at line 204
void prepend(string $key, mixed $value)

Prepend a value onto an array configuration value.

The config repository is a process-global singleton; per-request mutation races across coroutines and affects every concurrent request.

Parameters

string $key
mixed $value

Return Value

void

at line 220
void push(string $key, mixed $value)

Push a value onto an array configuration value.

The config repository is a process-global singleton; per-request mutation races across coroutines and affects every concurrent request.

Parameters

string $key
mixed $value

Return Value

void

at line 235
array all()

Get all of the configuration items for the application.

Return Value

array

at line 245
void replaceItems(array $items)

internal  
 

Replace all configuration items without reporting a mutation.

Parameters

array $items

Return Value

void

at line 255
void setMutationObserver(Closure $observer)

internal  
 

Set the observer invoked after each configuration mutation.

Parameters

Closure $observer

Return Value

void

at line 265
bool offsetExists(int|string $offset)

Determine if the given configuration option exists.

Parameters

int|string $offset

Return Value

bool

at line 275
mixed offsetGet(int|string $offset)

Get a configuration option.

Parameters

int|string $offset

Return Value

mixed

at line 289
void offsetSet(int|string $offset, mixed $value)

Set a configuration option.

The config repository is a process-global singleton; per-request mutation races across coroutines and affects every concurrent request.

Parameters

int|string $offset
mixed $value

Return Value

void

at line 303
void offsetUnset(int|string $offset)

Unset a configuration option.

The config repository is a process-global singleton; per-request mutation races across coroutines and affects every concurrent request.

Parameters

int|string $offset

Return Value

void

at line 312
static void flushState()

Flush all static state.

Return Value

void