SingletonModifier   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
c 1
b 0
f 1
dl 0
loc 19
ccs 0
cts 11
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 7 2
A create() 0 3 1
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\modifiers;
12
13
abstract class SingletonModifier implements ModifierInterface
14
{
15
    protected static $_instance;
16
17
    public static function getInstance()
18
    {
19
        if (static::$_instance === null) {
20
            static::$_instance = new static();
21
        }
22
23
        return static::$_instance;
24
    }
25
26
    public static function create()
27
    {
28
        return static::getInstance();
29
    }
30
31
    abstract public function modify($command);
32
}
33