Completed
Push — master ( cefe8d...0ca202 )
by Andrii
03:36
created

AbstractRenderer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getConfig() 0 4 1
A setHistory() 0 5 1
A getHistory() 0 4 1
render() 0 1 ?
1
<?php
2
/**
3
 * Changelog keeper
4
 *
5
 * @link      https://github.com/hiqdev/chkipper
6
 * @package   chkipper
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\chkipper\history;
12
13
/**
14
 * Abstract history renderer.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
abstract class AbstractRenderer
19
{
20
    /**
21
     * @var ConfigInterface config object
22
     */
23
    protected $_config;
24
25
    public $normalizeOptions = [];
26
27 2
    public function __construct(ConfigInterface $config)
28
    {
29 2
        $this->_config = $config;
30 2
    }
31
32 1
    public function getConfig()
33
    {
34 1
        return $this->_config;
35
    }
36
37 2
    public function setHistory($value)
38
    {
39 2
        $this->_history = $value;
0 ignored issues
show
Bug introduced by
The property _history does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
40 2
        $this->_history->normalize($this->normalizeOptions);
41 2
    }
42
43 2
    public function getHistory()
44
    {
45 2
        return $this->_history;
46
    }
47
48
    /**
49
     * Renders history to string.
50
     * @param History $history
51
     * @return string
52
     */
53
    abstract public function render(History $history);
54
}
55