SingletonTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A instance() 0 7 2
1
<?php
2
3
namespace Nip\Utility\Traits;
4
5
/**
6
 * Trait SingletonTrait
7
 * @package Nip\Utility\Traits
8
 */
9
trait SingletonTrait
10
{
11
    /**
12
     * Singleton
13
     *
14
     * @return self
15
     */
16
    public static function instance()
17
    {
18
        static $instance;
19
        if (!($instance instanceof self)) {
20
            $instance = new self();
21
        }
22
        return $instance;
23
    }
24
}
25