Make singleton constructor private
This commit is contained in:
parent
0a449fbb4c
commit
424faf83a0
|
@ -31,12 +31,12 @@ trait Singleton
|
||||||
/**
|
/**
|
||||||
* Holds the singleton instance.
|
* Holds the singleton instance.
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access private
|
||||||
* @static
|
* @static
|
||||||
*
|
*
|
||||||
* @var self
|
* @var self
|
||||||
*/
|
*/
|
||||||
protected static $singleton;
|
private static ?self $singleton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a singleton instance of this class.
|
* Get a singleton instance of this class.
|
||||||
|
@ -57,13 +57,13 @@ trait Singleton
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a singleton class, thus the constructor is protected.
|
* This is a singleton class, thus the constructor is private.
|
||||||
* (Get an instance of this class by calling self::getInstance())
|
* (Get an instance of this class by calling self::getInstance())
|
||||||
*
|
*
|
||||||
* @access protected
|
* @access private
|
||||||
* @abstract
|
* @abstract
|
||||||
*/
|
*/
|
||||||
abstract protected function __construct();
|
abstract private function __construct();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a singleton class, thus cloning is prohibited.
|
* This is a singleton class, thus cloning is prohibited.
|
||||||
|
|
Loading…
Reference in New Issue