AbstractUtility   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 36
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A getConfig() 0 8 2
A setConfig() 0 4 1
1
<?php
2
3
namespace Botonomous\utility;
4
5
use Botonomous\Config;
6
7
/**
8
 * Class AbstractUtility.
9
 */
10
abstract class AbstractUtility
11
{
12
    private $config;
13
14
    /**
15
     * AbstractUtility constructor.
16
     *
17
     * @param Config|null $config
18
     */
19 149
    public function __construct(Config $config = null)
20
    {
21 149
        if ($config !== null) {
22 16
            $this->setConfig($config);
23
        }
24 149
    }
25
26
    /**
27
     * @return Config
28
     */
29 34
    public function getConfig(): Config
30
    {
31 34
        if ($this->config === null) {
32 18
            $this->config = new Config();
33
        }
34
35 34
        return $this->config;
36
    }
37
38
    /**
39
     * @param Config $config
40
     */
41 16
    public function setConfig(Config $config)
42
    {
43 16
        $this->config = $config;
44 16
    }
45
}
46