UtilsBase::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace JimmyOak\Utility;
4
5
abstract class UtilsBase
6
{
7
    protected function __construct()
8
    {
9
    }
10
11
    public static function instance()
12
    {
13
        static $instance = null;
14
15
        if ($instance === null) {
16
            $instance = new static();
17
        }
18
19
        return $instance;
20
    }
21
22
    public function __clone()
23
    {
24
        throw new \Exception('Singleton class, use instance() method');
25
    }
26
}
27