Completed
Push — master ( dc889e...13f9c8 )
by Andrii
02:52
created

Note   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 81.25%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 6
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 35
ccs 13
cts 16
cp 0.8125
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A findCommit() 0 8 2
A getCommits() 0 4 1
A setNote() 0 4 1
A getNote() 0 4 1
1
<?php
2
3
/*
4
 * Changelog keeper
5
 *
6
 * @link      https://github.com/hiqdev/chkipper
7
 * @package   chkipper
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\chkipper\history;
13
14
/**
15
 * Note class.
16
 * Holds note and list of commits.
17
 *
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class Note
21
{
22
    protected $_note;
23
    protected $_commits = [];
24
25 2
    public function __construct($note, $commits = [])
26
    {
27 2
        $this->_note    = $note;
28 2
        $this->_commits = $commits;
29 2
    }
30
31 2
    public function findCommit($hash)
32
    {
33 2
        if (!isset($this->_commits[$hash])) {
34 2
            $this->_commits[$hash] = new Commit($hash);
35 2
        }
36
37 2
        return $this->_commits[$hash];
38
    }
39
40 1
    public function getCommits()
41
    {
42 1
        return $this->_commits;
43
    }
44
45
    public function setNote($value)
46
    {
47
        $this->_note = $value;
48
    }
49
50 1
    public function getNote()
51
    {
52 1
        return $this->_note;
53
    }
54
}
55