class Repository implements ArrayAccess, Repository (View source)

Traits

Properties

static protected array $macros

The registered string macros.

from  Macroable
protected array<string, mixed> $items

All of the configuration items.

Methods

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

Register a custom macro.

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

Mix another object into the class.

static bool
hasMacro(string $name)

Checks 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<string, mixed>
getMany(array<string|int, mixed> $keys)

Get many configuration values.

string
string(string $key, Closure(): string|null|string|null $default = null)

Get the specified string configuration value.

int
integer(string $key, Closure(): int|null|int|null $default = null)

Get the specified integer configuration value.

float
float(string $key, Closure(): float|null|float|null $default = null)

Get the specified float configuration value.

bool
boolean(string $key, Closure(): bool|null|bool|null $default = null)

Get the specified boolean configuration value.

array
array(string $key, Closure(): array<array-key, mixed>|null|array<array-key, mixed>|null $default = null)

Get the specified array configuration value.

collection(string $key, Closure(): array<array-key, mixed>|null|array<array-key, mixed>|null $default = null)

Get the specified array 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<string, mixed>
all()

Get all of the configuration items for the application.

bool
offsetExists(string $offset)

Determine if the given configuration option exists.

mixed
offsetGet(string $offset)

Get a configuration option.

void
offsetSet(string $offset, mixed $value)

Set a configuration option.

void
offsetUnset(string $offset)

Unset a configuration option.

Details

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

Register a custom macro.

Parameters

string $name
object|callable $macro

Return Value

void

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

Mix another object into the class.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Checks if macro is registered.

Parameters

string $name

Return Value

bool

static void flushMacros()

Flush the existing macros.

Return Value

void

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

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Dynamically handle calls to the class.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

__construct(array $items = [])

Create a new configuration repository.

Parameters

array $items

bool has(string $key)

Determine if the given configuration value exists.

Parameters

string $key

Return Value

bool

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

Get the specified configuration value.

Parameters

array|string $key
mixed $default

Return Value

mixed

array<string, mixed> getMany(array<string|int, mixed> $keys)

Get many configuration values.

Parameters

array<string|int, mixed> $keys

Return Value

array<string, mixed>

string string(string $key, Closure(): string|null|string|null $default = null)

Get the specified string configuration value.

Parameters

string $key
Closure(): string|null|string|null $default

Return Value

string

Exceptions

InvalidArgumentException

int integer(string $key, Closure(): int|null|int|null $default = null)

Get the specified integer configuration value.

Parameters

string $key
Closure(): int|null|int|null $default

Return Value

int

Exceptions

InvalidArgumentException

float float(string $key, Closure(): float|null|float|null $default = null)

Get the specified float configuration value.

Parameters

string $key
Closure(): float|null|float|null $default

Return Value

float

Exceptions

InvalidArgumentException

bool boolean(string $key, Closure(): bool|null|bool|null $default = null)

Get the specified boolean configuration value.

Parameters

string $key
Closure(): bool|null|bool|null $default

Return Value

bool

Exceptions

InvalidArgumentException

array array(string $key, Closure(): array<array-key, mixed>|null|array<array-key, mixed>|null $default = null)

Get the specified array configuration value.

Parameters

string $key
Closure(): array<array-key, mixed>|null|array<array-key, mixed>|null $default

Return Value

array

Exceptions

InvalidArgumentException

Collection collection(string $key, Closure(): array<array-key, mixed>|null|array<array-key, mixed>|null $default = null)

Get the specified array configuration value as a collection.

Parameters

string $key
Closure(): array<array-key, mixed>|null|array<array-key, mixed>|null $default

Return Value

Collection

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

Set a given configuration value.

Parameters

array|string $key
mixed $value

Return Value

void

void prepend(string $key, mixed $value)

Prepend a value onto an array configuration value.

Parameters

string $key
mixed $value

Return Value

void

void push(string $key, mixed $value)

Push a value onto an array configuration value.

Parameters

string $key
mixed $value

Return Value

void

array<string, mixed> all()

Get all of the configuration items for the application.

Return Value

array<string, mixed>

bool offsetExists(string $offset)

Determine if the given configuration option exists.

Parameters

string $offset

Return Value

bool

mixed offsetGet(string $offset)

Get a configuration option.

Parameters

string $offset

Return Value

mixed

void offsetSet(string $offset, mixed $value)

Set a configuration option.

Parameters

string $offset
mixed $value

Return Value

void

void offsetUnset(string $offset)

Unset a configuration option.

Parameters

string $offset

Return Value

void