Completed
Push — master ( 45e66e...a2014d )
by Kacper
03:25
created

Singleton   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 3
cts 6
cp 0.5
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 1 1
A get() 0 9 2
1
<?php
2
/**
3
 * Highlighter
4
 *
5
 * Copyright (C) 2016, Some right reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Highlighter\Utils;
17
18
trait Singleton
19
{
20
    /**
21
     * @var static
22
     */
23
    private static $_instance;
24
25
    /**
26
     * @return static
27
     */
28 7
    public static function get()
29
    {
30 7
        if (!isset(self::$_instance)) {
31
            self::$_instance = new static();
32
            self::$_instance->init();
33
        }
34
35 7
        return self::$_instance;
36
    }
37
38
    public function init() {}
39
}
40