Completed
Push — trunk ( d06df9...f48ee3 )
by SuperNova.WS
11:23
created

TSingleton   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A me() 0 6 2
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
Since $_me is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $_me to at least protected.
Loading history...
18
      static::$_me = new static();
19
    }
20
21
    return static::$_me;
22
  }
23
24
}
25