2018-11-12 16:58:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
trait SingletonTrait
|
|
|
|
{
|
|
|
|
private static $instance;
|
|
|
|
|
2018-11-19 14:14:27 +01:00
|
|
|
protected function __construct()
|
2018-11-12 16:58:56 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getInstance()
|
|
|
|
{
|
|
|
|
if (!isset(static::$instance)) {
|
|
|
|
static::$instance = new static();
|
|
|
|
}
|
|
|
|
return static::$instance;
|
|
|
|
}
|
|
|
|
}
|