SingletonTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 7 2
1
<?php
2
/**
3
 * Webino™ (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino for the canonical source repository
6
 * @copyright   Copyright (c) 2015-2017 Webino, s.r.o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoBaseLib\Util;
12
13
/**
14
 * Class SingletonTrait
15
 */
16
trait SingletonTrait
17
{
18
    /**
19
     * @var $this
20
     */
21
    protected static $instance;
22
23
    /**
24
     * @return $this
25
     */
26
    public static function getInstance()
27
    {
28
        if (null === static::$instance) {
29
            static::$instance = new static;
30
        }
31
        return static::$instance;
32
    }
33
}
34