Fr3nch13/CakePHP Utilities

Container extends Container
in package
implements ContainerInterface

Dependency Injection container

Based on the container out of League\Container

Table of Contents

Interfaces

ContainerInterface
Interface for the Dependency Injection Container in CakePHP applications

Properties

$defaultToShared  : bool
$definitions  : DefinitionAggregateInterface
$delegates  : array<string|int, ContainerInterface>
$inflectors  : InflectorAggregateInterface
$providers  : ServiceProviderAggregateInterface

Methods

__construct()  : mixed
add()  : DefinitionInterface
addServiceProvider()  : DefinitionContainerInterface
addShared()  : DefinitionInterface
defaultToShared()  : ContainerInterface
delegate()  : self
extend()  : DefinitionInterface
get()  : RequestedType|mixed
Finds an entry of the container by its identifier and returns it.
getNew()  : RequestedType|mixed
has()  : bool
Returns true if the container can return an entry for the given identifier.
inflector()  : InflectorInterface
resolve()  : mixed

Properties

$defaultToShared

protected bool $defaultToShared = false

Methods

get()

Finds an entry of the container by its identifier and returns it.

public get(RequestedType>|string $id) : RequestedType|mixed
Parameters
$id : RequestedType>|string
Tags
template

RequestedType

Return values
RequestedType|mixed

getNew()

public getNew(RequestedType>|string $id) : RequestedType|mixed
Parameters
$id : RequestedType>|string
Tags
template

RequestedType

Return values
RequestedType|mixed

has()

Returns true if the container can return an entry for the given identifier.

public has(mixed $id) : bool

Returns false otherwise.

has($id) returning true does not mean that get($id) will not throw an exception. It does however mean that get($id) will not throw a NotFoundExceptionInterface.

Parameters
$id : mixed

Identifier of the entry to look for.

Return values
bool

resolve()

protected resolve(mixed $id[, bool $new = false ]) : mixed
Parameters
$id : mixed
$new : bool = false

        
On this page

Search results