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

SingletonModifier   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 20
ccs 0
cts 11
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 8 2
A create() 0 4 1
modify() 0 1 ?
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