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

SingletonModifier::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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