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

Singleton::singleton()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
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