PHP Класс Inpsyde\MultilingualPress\Service\AddOnlyContainer

С версии: 3.0.0
Наследование: implements Inpsyde\MultilingualPress\Service\Container
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( array $values = [] ) Constructor. Sets up the properties.
bootstrap ( ) : void Bootstraps (and locks) the container.
extend ( string $name, callable $new_factory ) : static Replaces the factory callback with the given name with the given factory callback.
lock ( ) : void Locks the container.
offsetExists ( string $name ) : boolean Checks if a value or factory callback with the given name exists.
offsetGet ( string $name ) : mixed Returns the value or factory callback with the given name.
offsetSet ( string $name, mixed $value ) : void Stores the given value or factory callback with the given name.
offsetUnset ( string $name ) : void Removes the value or factory callback with the given name.
share ( string $name, mixed $value ) : static Stores the given value or factory callback with the given name, and defines it to be accessible even after the container has been bootstrapped.

Описание методов

__construct() публичный Метод

Constructor. Sets up the properties.
С версии: 3.0.0
public __construct ( array $values = [] )
$values array Initial values or factory callbacks to be stored.

bootstrap() публичный Метод

Only shared values and factory callbacks are accessible from now on.
С версии: 3.0.0
public bootstrap ( ) : void
Результат void

extend() публичный Метод

The new factory callback will receive as first argument the object created by the current factory, and as second argument the container.
С версии: 3.0.0
public extend ( string $name, callable $new_factory ) : static
$name string The name of an existing factory callback.
$new_factory callable The new factory callback.
Результат static Container instance.

lock() публичный Метод

A locked container cannot be manipulated anymore. All stored values and factory callbacks are still accessible.
С версии: 3.0.0
public lock ( ) : void
Результат void

offsetExists() публичный Метод

Checks if a value or factory callback with the given name exists.
С версии: 3.0.0
public offsetExists ( string $name ) : boolean
$name string The name of a value or factory callback.
Результат boolean Whether or not a value or factory callback with the given name exists.

offsetGet() публичный Метод

Returns the value or factory callback with the given name.
С версии: 3.0.0
public offsetGet ( string $name ) : mixed
$name string The name of a value or factory callback.
Результат mixed The value or factory callback with the given name.

offsetSet() публичный Метод

Scalar values will get shared automatically.
С версии: 3.0.0
public offsetSet ( string $name, mixed $value ) : void
$name string The name of a value or factory callback.
$value mixed The value or factory callback.
Результат void

offsetUnset() публичный Метод

Removing values or factory callbacks is not allowed.
С версии: 3.0.0
public offsetUnset ( string $name ) : void
$name string The name of a value or factory callback.
Результат void

share() публичный Метод

Stores the given value or factory callback with the given name, and defines it to be accessible even after the container has been bootstrapped.
С версии: 3.0.0
public share ( string $name, mixed $value ) : static
$name string The name of a value or factory callback.
$value mixed The value or factory callback.
Результат static Container instance.