Completed
Push — master ( d24069...59bb94 )
by Andrii
03:18
created

SingletonModifier::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php
2
3
/*
4
 * Task runner, code generator and build tool for easier continuos integration
5
 *
6
 * @link      https://github.com/hiqdev/hidev
7
 * @package   hidev
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hidev\modifiers;
13
14
abstract class SingletonModifier implements ModifierInterface
15
{
16
    protected static $_instance;
17
18
    public static function getInstance()
19
    {
20
        if (static::$_instance === null) {
21
            static::$_instance = new static();
22
        }
23
24
        return static::$_instance;
25
    }
26
27
    public static function create()
28
    {
29
        return static::getInstance();
30
    }
31
32
    abstract public function modify($command);
33
}
34