HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/owlcrmlanding/wp-content/plugins/go-live-update-urls/src/Traits/Singleton.php
<?php

namespace Go_Live_Update_Urls\Traits;

trait Singleton {

	/**
	 * Actions and filters, which are called during `init`.
	 *
	 * @return void
	 */
	protected function hook() {
	}


	/**
	 * Instance of this class for use as singleton
	 *
	 * @var self|null
	 */
	protected static $instance;


	/**
	 * Create the instance of the class
	 *
	 * @static
	 * @return void
	 */
	public static function init() {
		static::instance()->hook();
	}


	/**
	 * Get (and instantiate, if necessary) the instance of the
	 * class
	 *
	 * @static
	 * @return self
	 */
	public static function instance() {
		if ( null === static::$instance || ! is_a( static::$instance, __CLASS__ ) ) {
			static::$instance = new static(); // @phpstan-ignore-line
		}
		return static::$instance;
	}
}