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

Instance   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
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