Completed
Push — develop ( cba78f...09bcdb )
by Nicolas
12:47
created

Jobbers::isInit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace devtransition\jobbers;
4
5
class Jobbers
6
{
7
    /* @var Jobbers Singleton instance of Jobbers */
8
    private static $_instance;
9
10
    /* @var Loader Loader instance */
11
    private $_loader;
0 ignored issues
show
Unused Code introduced by
The property $_loader is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
12
13
    // default config
14
    private $_config = [
15
        'timeout' => 10,
16
    ];
17
18
    public static function isInit()
19
    {
20
        return (self::$_instance !== null);
21
    }
22
23
    public static function getInstance()
24
    {
25
        return self::$_instance;
26
    }
27
28
    public static function config($config)
29
    {
30
        self::init();
31
        self::$_instance->setConfig($config);
32
    }
33
34
    public static function init()
35
    {
36
        if (!self::$_instance) {
37
            self::$_instance = new self;
38
        }
39
    }
40
41
    public function getConfig()
42
    {
43
        return $this->_config;
44
    }
45
46
    public function setConfig($config)
47
    {
48
        $this->_config = array_merge(
49
            $this->_config,
50
            $config
51
        );
52
    }
53
54
}