Automattic\WooCommerce\Internal\DependencyManagement
Definition{} WC 1.0
An extension of the definition class that replaces constructor injection with method injection.
Хуков нет.
Возвращает
Null. Ничего.
Использование
$Definition = new Definition(); // use class methods
Методы
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- resolveClass( string $concrete )
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
Код Definition{} Definition{} WC 4.9.1
class Definition extends BaseDefinition {
/**
* The standard method that we use for dependency injection.
*/
const INJECTION_METHOD = 'init';
/**
* Resolve a class using method injection instead of constructor injection.
*
* @param string $concrete The concrete to instantiate.
*
* @return object
*/
protected function resolveClass( string $concrete ) {
$resolved = $this->resolveArguments( $this->arguments );
$concrete = new $concrete();
// Constructor injection causes backwards compatibility problems
// so we will rely on method injection via an internal method.
if ( method_exists( $concrete, static::INJECTION_METHOD ) ) {
call_user_func_array( array( $concrete, static::INJECTION_METHOD ), $resolved );
}
return $concrete;
}
}