Automattic\WooCommerce\Internal\DependencyManagement

ExtendedContainer::get_class_from_concrete()protectedWC 1.0

Gets the class from the concrete regardless of type.

Method of the class: ExtendedContainer{}

No Hooks.

Return

String|null. The class from the concrete if one is available, null otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_class_from_concrete( $concrete );
$concrete(mixed) (required)
The concrete that we want the class from..

ExtendedContainer::get_class_from_concrete() code WC 8.7.0

protected function get_class_from_concrete( $concrete ) {
	if ( is_object( $concrete ) && ! is_callable( $concrete ) ) {
		if ( $concrete instanceof DefinitionInterface ) {
			return $this->get_class_from_concrete( $concrete->getConcrete() );
		}

		return get_class( $concrete );
	}

	if ( is_string( $concrete ) && class_exists( $concrete ) ) {
		return $concrete;
	}

	return null;
}