Completed
Push — master ( 467d47...6f2bb4 )
by Anton
14s
created

Instance::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
nc 2
dl 0
loc 8
ccs 5
cts 5
cp 1
c 0
b 0
f 0
cc 2
eloc 5
nop 0
crap 2
rs 9.4285
1
<?php
2
/**
3
 * Bluz Framework Component
4
 *
5
 * @copyright Bluz PHP Team
6
 * @link      https://github.com/bluzphp/framework
7
 */
8
9
declare(strict_types=1);
10
11
namespace Bluz\Common;
12
13
/**
14
 * Instance
15
 *
16
 * @package  Bluz\Common
17
 * @author   Anton Shevchuk
18
 */
19
trait Instance
20
{
21
    /**
22
     * Get instance
23
     * @return static
24
     */
25 56
    public static function getInstance()
26
    {
27 56
        static $instance;
28 56
        if (null === $instance) {
29 3
            $instance = new static();
30
        }
31 56
        return $instance;
32
    }
33
}
34