Combination dependency-injection and service-locator method; returns
a dependency object as passed, or an object from the registry, or a
new factory instance.
public static dependency ( string $class, mixed $spec ) : object | ||
$class | string | 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. |
$spec | mixed | 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. |
return | object | The dependency object. |