setSingleton() public method
Registers a class definition with this container and marks the class as a singleton class.
This method is similar to set() except that classes registered via this method will only have one instance. Each time get() is called, the same instance of the specified class will be returned.
See also set().
public $this setSingleton ( $class, $definition = [], array $params = [] ) | ||
---|---|---|
$class | string |
Class name, interface name or alias name |
$definition | mixed |
The definition associated with |
$params | array |
The list of constructor parameters. The parameters will be passed to the class constructor when get() is called. |
return | $this |
The container itself |
Please login to continue.