# better-payment/2.3.0/includes/Traits/HasSingletone.php

Better Payment – Instant Payments, Donations, Fundraising with Subscriptions &amp; More, version 2.3.0. 36 lines.

- Page: https://pluginprobe.com/plugins/better-payment/2.3.0/code/includes/Traits/HasSingletone.php
- Raw: https://pluginprobe.com/plugins/better-payment/2.3.0/raw/includes/Traits/HasSingletone.php
- Modified: 2026-04-21T06:11:16+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/better-payment/2.3.0/code/includes/Traits/HasSingletone.php#L10-L20`.

```php
<?php

namespace Better_Payment\Lite\Traits;

trait HasSingletone {
	/**
	 * Holds the plugin instance.
	 *
	 * @since 2.0.0
	 * @access private
	 * @static
	 *
	 * @var static
	 */
	protected static $instances = array();
	/**
	 * Sets up a single instance of the plugin.
	 *
	 * @since 2.0.0
	 * @access public
	 * @var mixed $args
	 *
	 * @static
	 *
	 * @return static An instance of the class.
	 */
	public static function get_instance( ...$args ) {
		if ( ! isset( self::$instances[ static::class ] ) ) {
			self::$instances[ static::class ] = ! empty( $args ) ? new static( ...$args ) : new static();
		}

		return self::$instances[ static::class ];
	}

	protected function __construct( ...$args ) {}
}
```
