1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Libs;
- trait Singleton
- {
-
- private static $instance;
-
- public static function getInstance(...$args)
- {
- if (!(self::$instance instanceof self)) {
- self::$instance = new static($args);
- }
- return self::$instance;
- }
-
- public function __construct()
- {
- }
-
- private function __clone()
- {
- trigger_error('Clone is not allowed!');
- }
- }
|