HEX
Server: Apache/2.4.65 (Debian)
System: Linux 88f31f35b0b8 6.1.0-38-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.147-1 (2025-08-02) x86_64
User: www-data (33)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/html/wp-content/plugins/advanced-ads/includes/abstracts/abstract-factory.php
<?php
/**
 * Abstracts Factory.
 *
 * @package AdvancedAds
 * @author  Advanced Ads <info@wpadvancedads.com>
 * @since   1.47.0
 */

namespace AdvancedAds\Abstracts;

defined( 'ABSPATH' ) || exit;

/**
 * Abstracts Factory.
 */
abstract class Factory {

	/**
	 * Retrieves the classname for entity type.
	 *
	 * @param Types  $manager      The manager object.
	 * @param string $entity_type  The entity type.
	 * @param string $default_type The entity default type.
	 *
	 * @return string The classname for the given entity type.
	 */
	public function get_classname( $manager, $entity_type, $default_type = 'default' ) {
		// If the manager is called outside `init` hook, we need to initialize it.
		if ( empty( $manager->get_types() ) || ! $manager->has_type( $default_type ) ) {
			$manager->register_types();
		}

		$type = $manager->has_type( $entity_type )
			? $manager->get_type( $entity_type )
			: $manager->get_type( $default_type );

		return $type->get_classname();
	}
}