abstract class Manager

Traits

Properties

protected Repository $config

The configuration repository instance.

protected array $customCreators

The registered custom driver creators.

protected array $drivers

The array of created "drivers".

Methods

Closure|null
bindCallbackToSelf(Closure $callback)

Bind the provided callback to the class instance.

__construct(Container $container)

Create a new manager instance.

string
getDefaultDriver()

Get the default driver name.

mixed
driver(UnitEnum|string|null $driver = null)

Get a driver instance.

mixed
createDriver(string $driver)

Create a new driver instance.

mixed
callCustomCreator(string $driver)

Call a custom driver creator.

extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

array
getDrivers()

Get all of the created "drivers".

getContainer()

Get the container instance used by the manager.

setContainer(Container $container)

Set the container instance used by the manager.

forgetDrivers()

Forget all of the resolved driver instances.

mixed
__call(string $method, array $parameters)

Dynamically call the default driver instance.

Details

protected Closure|null bindCallbackToSelf(Closure $callback)

Bind the provided callback to the class instance.

Parameters

Closure $callback

Return Value

Closure|null

Exceptions

ReflectionException

at line 37
__construct(Container $container)

Create a new manager instance.

Parameters

Container $container

at line 46
abstract string getDefaultDriver()

Get the default driver name.

Return Value

string

at line 53
mixed driver(UnitEnum|string|null $driver = null)

Get a driver instance.

Parameters

UnitEnum|string|null $driver

Return Value

mixed

Exceptions

InvalidArgumentException

at line 78
protected mixed createDriver(string $driver)

Create a new driver instance.

Parameters

string $driver

Return Value

mixed

Exceptions

InvalidArgumentException

at line 99
protected mixed callCustomCreator(string $driver)

Call a custom driver creator.

Parameters

string $driver

Return Value

mixed

at line 112
Manager extend(string $driver, Closure $callback)

Register a custom driver creator Closure.

Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent driver resolution.

Parameters

string $driver
Closure $callback

Return Value

Manager

at line 129
array getDrivers()

Get all of the created "drivers".

Return Value

array

at line 137
Container getContainer()

Get the container instance used by the manager.

Return Value

Container

at line 151
Manager setContainer(Container $container)

Set the container instance used by the manager.

Tests only. Swaps the singleton's container reference; per-request use races across coroutines and breaks every concurrent driver resolution through this manager.

Parameters

Container $container

Return Value

Manager

at line 167
Manager forgetDrivers()

Forget all of the resolved driver instances.

Boot or tests only. Clears the singleton's driver cache; concurrent coroutines may already hold references that next resolution will not share.

Return Value

Manager

at line 177
mixed __call(string $method, array $parameters)

Dynamically call the default driver instance.

Parameters

string $method
array $parameters

Return Value

mixed