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

Note::getCommits()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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