SingletonModifier::getInstance()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
c 1
b 0
f 1
nc 2
nop 0
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 6
rs 10
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