| 1 |
<?php |
| 2 |
|
| 3 |
namespace MailerLite\Includes\Classes; |
| 4 |
|
| 5 |
abstract class Singleton |
| 6 |
{ |
| 7 |
|
| 8 |
/** |
| 9 |
* Class instance |
| 10 |
* @var $instance |
| 11 |
*/ |
| 12 |
protected static $instance; |
| 13 |
|
| 14 |
private function __construct() |
| 15 |
{ |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* Get the instance of the class |
| 20 |
* @return mixed |
| 21 |
*/ |
| 22 |
public static function getInstance() |
| 23 |
{ |
| 24 |
if ( ! static::$instance instanceof static) { |
| 25 |
static::$instance = new static(); |
| 26 |
} |
| 27 |
|
| 28 |
return static::$instance; |
| 29 |
} |
| 30 |
|
| 31 |
final protected function __clone() |
| 32 |
{ |
| 33 |
} |
| 34 |
} |