Completed
Push — trunk ( e8681e...314ee9 )
by SuperNova.WS
13:57
created

Singleton   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A singleton() 0 6 2
1
<?php
2
/**
3
 * Created by Gorlum 08.01.2018 15:33
4
 */
5
6
namespace Core;
7
8
9
class Singleton {
10
11
  private static $_singleton;
12
13
  public static function singleton() {
0 ignored issues
show
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
14
    if (empty(static::$_singleton)) {
0 ignored issues
show
Bug introduced by
Since $_singleton 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 $_singleton to at least protected.
Loading history...
15
      static::$_singleton = new static();
16
    }
17
18
    return static::$_singleton;
19
  }
20
21
}
22