|
Previous Page |
Solar |
Next Page |
dependency()
static public
object
dependency (
string $class,
mixed $spec
)
Combination dependency-injection and service-locator method; returns a dependency object as passed, or an object from the registry, or a new factory instance.
Parameters
- (string)
$class: The dependency object should be an instance of this class. Technically, this is more a hint than a requirement, although it will be used as the class name if Solar::factory() gets called. - (mixed)
$spec: If an object, check to make sure it's an instance of $class. If a string, treat as a Solar_Registry::get() key. Otherwise, use this as a config param to Solar::factory() to create a $class object.
Returns
- (object) The dependency object.
Description
Combination dependency-injection and service-locator method; returns a dependency object as passed, or an object from the registry, or a new factory instance.