# shopbuilder/2.2.1/app/Traits/SingletonTrait.php

ShopBuilder – WooCommerce Builder For Elementor, version 2.2.1. 55 lines.

- Page: https://pluginprobe.com/plugins/shopbuilder/2.2.1/code/app/Traits/SingletonTrait.php
- Raw: https://pluginprobe.com/plugins/shopbuilder/2.2.1/raw/app/Traits/SingletonTrait.php
- Modified: 2024-08-21T06:58:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shopbuilder/2.2.1/code/app/Traits/SingletonTrait.php#L10-L20`.

```php
<?php
/**
 *
 */

namespace RadiusTheme\SB\Traits;

// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
	exit( 'This script cannot be accessed directly.' );
}

trait SingletonTrait {
	/**
	 * The single instance of the class.
	 *
	 * @var object
	 */
	protected static $instance = null;


	/**
	 * Constructor
	 *
	 * @return void
	 */
	//	public function __construct() {}

	/**
	 * @return self
	 */
	final public static function instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}

		return self::$instance;
	}


	/**
	 * Prevent cloning.
	 */
	final public function __clone() {
	}

	/**
	 * Prevent unserializing.
	 */
	final public function __wakeup() {
		_doing_it_wrong( __FUNCTION__, esc_html__( 'Cheatin&#8217; huh?', 'shopbuilder' ), '1.0' );
		die();
	}
}

```
