ActionScheduler_ScheduleDeserializer::class_name_of │ private │ WC 1.0

Get the class name of an object parsed with a restricted allowed_classes set.

Objects whose class was disallowed become __PHP_Incomplete_Class, which hides the original name behind get_class(); it lives in the __PHP_Incomplete_Class_Name pseudo-property instead. stdClass is never converted by PHP, so its real name is returned directly.

Method of the class: ActionScheduler_ScheduleDeserializer{}

No Hooks.

Returns

string. The original class name, or '' if it cannot be determined.

Usage

// private - for code of main (parent) class only
$result = $this->class_name_of( $maybe_incomplete ): string;
$maybe_incomplete(object) (required)
Object parsed with a restricted allowed_classes set.

ActionScheduler_ScheduleDeserializer::class_name_of() code WC 11.3.0

private function class_name_of( object $maybe_incomplete ): string {
	if ( $maybe_incomplete instanceof __PHP_Incomplete_Class ) {
		$vars = (array) $maybe_incomplete;
		return isset( $vars['__PHP_Incomplete_Class_Name'] ) ? (string) $vars['__PHP_Incomplete_Class_Name'] : '';
	}

	return get_class( $maybe_incomplete );
}