supernova-ws /
SuperNova
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Created by Gorlum 03.09.2019 1:26 |
||
| 4 | */ |
||
| 5 | |||
| 6 | namespace Common\Traits; |
||
| 7 | |||
| 8 | |||
| 9 | trait TSingleton { |
||
| 10 | |||
| 11 | private static $_me = null; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @return static|null |
||
| 15 | */ |
||
| 16 | public static function me() { |
||
| 17 | if (empty(static::$_me)) { |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 18 | static::$_me = new static(); |
||
| 19 | } |
||
| 20 | |||
| 21 | return static::$_me; |
||
| 22 | } |
||
| 23 | |||
| 24 | } |
||
| 25 |