PHP Class Inpsyde\MultilingualPress\Service\AddOnlyContainer

Since: 3.0.0
Inheritance: implements Inpsyde\MultilingualPress\Service\Container
Afficher le fichier Open project: inpsyde/multilingual-press Class Usage Examples

Méthodes publiques

Méthode Description
__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.

Method Details

__construct() public méthode

Constructor. Sets up the properties.
Since: 3.0.0
public __construct ( array $values = [] )
$values array Initial values or factory callbacks to be stored.

bootstrap() public méthode

Only shared values and factory callbacks are accessible from now on.
Since: 3.0.0
public bootstrap ( ) : void
Résultat void

extend() public méthode

The new factory callback will receive as first argument the object created by the current factory, and as second argument the container.
Since: 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.
Résultat static Container instance.

lock() public méthode

A locked container cannot be manipulated anymore. All stored values and factory callbacks are still accessible.
Since: 3.0.0
public lock ( ) : void
Résultat void

offsetExists() public méthode

Checks if a value or factory callback with the given name exists.
Since: 3.0.0
public offsetExists ( string $name ) : boolean
$name string The name of a value or factory callback.
Résultat boolean Whether or not a value or factory callback with the given name exists.

offsetGet() public méthode

Returns the value or factory callback with the given name.
Since: 3.0.0
public offsetGet ( string $name ) : mixed
$name string The name of a value or factory callback.
Résultat mixed The value or factory callback with the given name.

offsetSet() public méthode

Scalar values will get shared automatically.
Since: 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.
Résultat void

offsetUnset() public méthode

Removing values or factory callbacks is not allowed.
Since: 3.0.0
public offsetUnset ( string $name ) : void
$name string The name of a value or factory callback.
Résultat void

share() public méthode

Stores the given value or factory callback with the given name, and defines it to be accessible even after the container has been bootstrapped.
Since: 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.
Résultat static Container instance.