Singleton::getInstance()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
3
namespace App;
4
5
/**
6
 * Class Singleton.
7
 */
8
abstract class Singleton
9
{
10
    /**
11
     * Create and return a User instance.
12
     *
13
     * @return $this
14
     */
15
    public static function getInstance()
16
    {
17
        static $instance = null;
18
19
        if ($instance === null) {
20
            $instance = new static();
21
        }
22
23
        return $instance;
24
    }
25
}
26