Spec-Zone.ru › CakePHP 4.4

Класс Container

Контейнер инъекции зависимостей

Основан на контейнере из League\Container

Пространство имён: Cake\Core

Краткое описание свойств

  • $defaultToShared protected
    boolean
  • $definitions protected
    DefinitionAggregateInterface
  • $delegates protected
    ContainerInterface[]
  • $inflectors protected
    InflectorAggregateInterface
  • $providers protected
    ServiceProviderAggregateInterface

Краткое описание методов

  • __construct() public
  • add() public
  • addServiceProvider() public
  • addShared() public
  • defaultToShared() public
  • delegate() public
  • extend() public
  • get() public

    Ищет запись в контейнере по её идентификатору и возвращает её.

  • getNew() public
  • has() public

    Возвращает true, если контейнер может вернуть запись для данного идентификатора. В противном случае возвращает false.

  • inflector() public
  • resolve() protected

Подробное описание методов

__construct() public

__construct(DefinitionAggregateInterface $definitions = null, ServiceProviderAggregateInterface $providers = null, InflectorAggregateInterface $inflectors = null)

Параметры

DefinitionAggregateInterface $definitions по желанию
ServiceProviderAggregateInterface $providers по желанию
InflectorAggregateInterface $inflectors по желанию

add() public

add(string $id, mixed $concrete = null): DefinitionInterface

Параметры

string $id
$concrete по желанию

Возвращает

DefinitionInterface

addServiceProvider() public

addServiceProvider(ServiceProviderInterface $provider): self

Параметры

ServiceProviderInterface $provider

Возвращает

self

addShared() public

addShared(string $id, mixed $concrete = null): DefinitionInterface

Параметры

string $id
$concrete по желанию

Возвращает

DefinitionInterface

defaultToShared() public

defaultToShared(bool $shared = true): ContainerInterface

Параметры

bool $shared по желанию

Возвращает

ContainerInterface

delegate() public

delegate(ContainerInterface $container): self

Параметры

ContainerInterface $container

Возвращает

self

extend() public

extend(string $id): DefinitionInterface

Параметры

string $id

Возвращает

DefinitionInterface

get() public

get(string $id): mixed

Ищет запись в контейнере по её идентификатору и возвращает её.

Параметры

string $id

Идентификатор записи для поиска.

Возвращает

mixed

Вызывает

NotFoundExceptionInterface
Запись не найдена для этого идентификатора.
ContainerExceptionInterface
Ошибка при получении записи.

getNew() public

getNew(mixed $id)

Параметры

$id

has() public

has(string $id): bool

Возвращает true, если контейнер может вернуть запись для данного идентификатора. В противном случае возвращает false.

has($id) Возвращение true не означает, что get($id) не выбросит исключение. Однако это означает, что get($id) не выбросит исключение NotFoundExceptionInterface.

Параметры

string $id

Идентификатор записи для поиска.

Возвращает

bool

inflector() public

inflector(string $type, callable $callback = null): InflectorInterface

Параметры

string $type
callable $callback по желанию

Возвращает

InflectorInterface

resolve() protected

resolve(mixed $id, bool $new = false)

Параметры

$id
bool $new по желанию

Подробное описание свойств

$defaultToShared protected

Тип

boolean

$definitions protected

Тип

DefinitionAggregateInterface

$delegates protected

Тип

ContainerInterface[]

$inflectors protected

Тип

InflectorAggregateInterface

$providers protected

Тип

ServiceProviderAggregateInterface

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Core.Container.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API