Singleton

A_Z_Listing_Singleton


Description


Source

File: src/Singleton.php

abstract class Singleton {
	/**
	 * Instances
	 *
	 * @var array
	 */
	private static $_instances = array();

	/**
	 * Singleton
	 *
	 * @return Extension extension object.
	 */
	final public static function instance() {
		$class = get_called_class();
		if ( ! isset( self::$_instances[ $class ] ) ) {
			self::$_instances[ $class ] = new $class();
		}
		return self::$_instances[ $class ];
	}

	/**
	 * Activate
	 *
	 * @param string $file   the plugin file.
	 * @param string $plugin the plugin details.
	 *
	 * @return Singleton
	 */
	public function activate( $file = '', $plugin = '' ) {
		return $this;
	}

	/**
	 * Initialize
	 */
	abstract public function initialize();
}

More Information

You are currently logged out. To view tickets you must first login.

I have read and understood the Terms of Service


Methods


User Contributed Notes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.