Свойство | Type | Description | |
---|---|---|---|
$id | the component ID, class name, interface name or alias name |
Méthode | Description | |
---|---|---|
ensure ( object | string | array | static $reference, string $type = null, |
Resolves the specified reference into the actual object and makes sure it is of the specified type. | |
get ( |
Returns the actual object referenced by this Instance object. | |
of ( string $id ) : |
Creates a new Instance object. |
Méthode | Description | |
---|---|---|
__construct ( string $id ) | Constructor. |
protected __construct ( string $id ) | ||
$id | string | the component ID |
public static ensure ( object | string | array | static $reference, string $type = null, |
||
$reference | object | string | array | static | an object or a reference to the desired object. You may specify a reference in terms of a component ID or an Instance object. Starting from version 2.0.2, you may also pass in a configuration array for creating the object. If the "class" value is not specified in the configuration array, it will use the value of `$type`. |
$type | string | the class/interface name to be checked. If null, type check will not be performed. |
$container | the container. This will be passed to [[get()]]. | |
Résultat | object | the object referenced by the Instance, or `$reference` itself if it is an object. |