Repository
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
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a new configuration repository.
Determine if the given configuration value exists.
Get the specified configuration value.
Get many configuration values.
Get the specified string configuration value.
Get the specified integer configuration value.
Get the specified float configuration value.
Get the specified boolean configuration value.
Get the specified array configuration value.
Get the specified configuration value as a Collection.
Set a given configuration value.
Prepend a value onto an array configuration value.
Push a value onto an array configuration value.
Get all of the configuration items for the application.
Replace all configuration items without reporting a mutation.
Determine if the given configuration option exists.
Get a configuration option.
Set a configuration option.
Unset a configuration option.
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.
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.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
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.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 28
__construct(array $items = [])
Create a new configuration repository.
at line 35
bool
has(string $key)
Determine if the given configuration value exists.
at line 43
mixed
get(array|string $key, mixed $default = null)
Get the specified configuration value.
at line 55
array
getMany(array $keys)
Get many configuration values.
at line 76
string
string(string $key, mixed $default = null)
Get the specified string configuration value.
at line 95
int
integer(string $key, mixed $default = null)
Get the specified integer configuration value.
at line 114
float
float(string $key, mixed $default = null)
Get the specified float configuration value.
at line 133
bool
boolean(string $key, mixed $default = null)
Get the specified boolean configuration value.
at line 153
array
array(string $key, mixed $default = null)
Get the specified array configuration value.
at line 173
Collection
collection(string $key, mixed $default = null)
Get the specified configuration value as a Collection.
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.
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.
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.
at line 235
array
all()
Get all of the configuration items for the application.
at line 245
void
replaceItems(array $items)
| internal |
Replace all configuration items without reporting a mutation.
at line 255
void
setMutationObserver(Closure $observer)
| internal |
Set the observer invoked after each configuration mutation.
at line 265
bool
offsetExists(int|string $offset)
Determine if the given configuration option exists.
at line 275
mixed
offsetGet(int|string $offset)
Get a configuration option.
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.
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.
at line 312
static void
flushState()
Flush all static state.