Completed
Push — development ( e80362...5ad269 )
by Claudio
02:41
created

Singleton::getInstance()   A

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
 * @package App
8
 */
9
abstract class Singleton
10
{
11
    /**
12
     * Create and return a User instance.
13
     *
14
     * @return $this
15
     */
16
    public static function getInstance()
17
    {
18
        static $instance = null;
19
20
        if ($instance === null) {
21
            $instance = new static();
22
        }
23
24
        return $instance;
25
    }
26
}
27