WordPress at Your Fingertips
class is not described

Automattic\WooCommerce\Internal\DependencyManagement

Definition{} WC 1.0

An extension of the definition class that replaces constructor injection with method injection.

No Hooks.

Return

null. Nothing.

Usage

$Definition = new Definition();
// use class methods

Methods

  1. ERROR: no method name found on line ``
  2. ERROR: no method name found on line ``
  3. ERROR: no method name found on line ``
  4. ERROR: no method name found on line ``
  5. ERROR: no method name found on line ``
  6. ERROR: no method name found on line ``
  7. ERROR: no method name found on line ``
  8. ERROR: no method name found on line ``
  9. ERROR: no method name found on line ``
  10. ERROR: no method name found on line ``
  11. ERROR: no method name found on line ``
  12. ERROR: no method name found on line ``
  13. ERROR: no method name found on line ``
  14. resolveClass( string $concrete )
  15. ERROR: no method name found on line ``
  16. ERROR: no method name found on line ``
  17. ERROR: no method name found on line ``
  18. ERROR: no method name found on line ``

Code of Definition{} WC 5.5.2

<?php
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;
	}
}