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 $key)

Determine if the given configuration option exists.

mixed
offsetGet(int|string $key)

Get a configuration option.

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

Set a configuration option.

void
offsetUnset(int|string $key)

Unset a configuration option.

static void
flushState()

Flush all static state.

Details

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

Register a custom macro.

Boot-only. 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 41
static void mixin(object $mixin, bool $replace = true)

Mix another object into the class.

Boot-only. 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 57
static bool hasMacro(string $name)

Check if macro is registered.

Parameters

string $name

Return Value

bool

in Macroable at line 68
static void flushMacros()

Flush the existing macros.

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

Return Value

void

in Macroable at line 78
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 103
mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

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

Create a new configuration repository.

Parameters

array $items

at line 34
bool has(string $key)

Determine if the given configuration value exists.

Parameters

string $key

Return Value

bool

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

Get the specified configuration value.

Parameters

array|string $key
mixed $default

Return Value

mixed

at line 54
array getMany(array $keys)

Get many configuration values.

Parameters

array $keys

Return Value

array

at line 75
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 94
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 113
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 132
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 152
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 172
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.

Boot or tests only. 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.

Boot or tests only. 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.

Boot or tests only. 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 232
array all()

Get all of the configuration items for the application.

Return Value

array

at line 242
void replaceItems(array $items)

internal  
 

Replace all configuration items without reporting a mutation.

Parameters

array $items

Return Value

void

at line 252
void setMutationObserver(Closure $observer)

internal  
 

Set the observer invoked after each configuration mutation.

Parameters

Closure $observer

Return Value

void

at line 262
bool offsetExists(int|string $key)

Determine if the given configuration option exists.

Parameters

int|string $key

Return Value

bool

at line 272
mixed offsetGet(int|string $key)

Get a configuration option.

Parameters

int|string $key

Return Value

mixed

at line 287
void offsetSet(int|string $key, mixed $value)

Set a configuration option.

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

Parameters

int|string $key
mixed $value

Return Value

void

at line 301
void offsetUnset(int|string $key)

Unset a configuration option.

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

Parameters

int|string $key

Return Value

void

at line 309
static void flushState()

Flush all static state.

Return Value

void