Passed
Push — master ( 1d0ea2...0f9d68 )
by Kacper
05:34
created

Singleton::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.2559

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 8
ccs 3
cts 5
cp 0.6
crap 2.2559
rs 10
c 2
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Highlighter
7
 *
8
 * Copyright (C) 2016, Some right reserved.
9
 *
10
 * @author Kacper "Kadet" Donat <[email protected]>
11
 *
12
 * Contact with author:
13
 * Xmpp: [email protected]
14
 * E-mail: [email protected]
15
 *
16
 * From Kadet with love.
17
 */
18
19
namespace Kadet\Highlighter\Utils;
20
21
trait Singleton
22
{
23
    /**
24
     * @var static
25
     */
26
    private static $_instance;
27
28
    /**
29
     * @return static
30
     */
31 8
    public static function get()
32
    {
33 8
        if (!isset(self::$_instance)) {
34
            self::$_instance = new static();
35
            self::$_instance->init();
36
        }
37
38 8
        return self::$_instance;
39
    }
40
41
    public function init() {}
42
}
43