# learnpress/4.4.2/inc/Helpers/Singleton.php

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version 4.4.2. 25 lines.

- Page: https://pluginprobe.com/plugins/learnpress/4.4.2/code/inc/Helpers/Singleton.php
- Raw: https://pluginprobe.com/plugins/learnpress/4.4.2/raw/inc/Helpers/Singleton.php
- Modified: 2026-07-11T02:31:30+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/learnpress/4.4.2/code/inc/Helpers/Singleton.php#L10-L20`.

```php
<?php

/**
 * Class Singleton
 */

namespace LearnPress\Helpers;

trait Singleton {
	private static $instance = null;
	final public static function instance(): self {
		if ( is_null( static::$instance ) ) {
			static::$instance = new static();
		}

		return static::$instance;
	}

	final private function __construct() {
		$this->init();
	}

	abstract function init();
}

```
