PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.3.1
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.3.1
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 All 66 releases
better-payment / includes / Traits / HasSingletone.php

HasSingletone.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.3.1, at includes/Traits/HasSingletone.php

36 lines 708 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Traits;
4
5 trait HasSingletone {
6 /**
7 * Holds the plugin instance.
8 *
9 * @since 2.0.0
10 * @access private
11 * @static
12 *
13 * @var static
14 */
15 protected static $instances = array();
16 /**
17 * Sets up a single instance of the plugin.
18 *
19 * @since 2.0.0
20 * @access public
21 * @var mixed $args
22 *
23 * @static
24 *
25 * @return static An instance of the class.
26 */
27 public static function get_instance( ...$args ) {
28 if ( ! isset( self::$instances[ static::class ] ) ) {
29 self::$instances[ static::class ] = ! empty( $args ) ? new static( ...$args ) : new static();
30 }
31
32 return self::$instances[ static::class ];
33 }
34
35 protected function __construct( ...$args ) {}
36 }