Completed
Pull Request — master (#10)
by Korotkov
02:00
created

Singleton::__clone()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
/**
4
 * @author  : Jagepard <[email protected]>
5
 * @license https://mit-license.org/ MIT
6
 */
7
8
namespace AntiPatterns\Singleton;
9
10
final class Singleton
11
{
12
    /**
13
     * @var self
14
     */
15
    private static $instance;
16
17
    /**
18
     * @return self
19
     */
20
    public static function getInstance(): self
21
    {
22
        if (!self::$instance instanceof self) {
0 ignored issues
show
introduced by
self::instance is always a sub-type of self.
Loading history...
23
            self::$instance = new self();
24
        }
25
26
        return self::$instance;
27
    }
28
29
    /**
30
     * SingletonTrait constructor.
31
     */
32
    public function __construct()
33
    {
34
    }
35
36
    /**
37
     * @codeCoverageIgnore
38
     */
39
    public function __sleep()
40
    {
41
    }
42
43
    /**
44
     * @codeCoverageIgnore
45
     */
46
    public function __wakeup()
47
    {
48
    }
49
50
    /**
51
     * @codeCoverageIgnore
52
     */
53
    public function __clone()
54
    {
55
    }
56
}
57