Completed
Pull Request — master (#451)
by Anton
13:12
created

Instance::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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
    public static function getInstance()
26
    {
27
        static $instance;
28
        if (null === $instance) {
29
            $instance = new static();
30
        }
31
        return $instance;
32
    }
33
}
34