1 | <?php |
||
21 | class Note |
||
22 | { |
||
23 | /** |
||
24 | * @var string note |
||
25 | */ |
||
26 | protected $_note; |
||
27 | |||
28 | /** |
||
29 | * @var Commit[] array of commits |
||
30 | */ |
||
31 | protected $_commits = []; |
||
32 | |||
33 | 3 | public function __construct($note, $commits = []) |
|
38 | |||
39 | 3 | public function findCommit($hash) |
|
40 | { |
||
41 | 3 | if (!isset($this->_commits[$hash])) { |
|
42 | 3 | $this->_commits[$hash] = new Commit($hash); |
|
43 | } |
||
44 | |||
45 | 3 | return $this->_commits[$hash]; |
|
46 | } |
||
47 | |||
48 | public function removeCommit($hash) |
||
52 | |||
53 | public function removeCommits($hashes) |
||
54 | { |
||
55 | foreach ($hashes as $hash) { |
||
56 | $this->removeCommit($hash); |
||
57 | } |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Appends commit along with comments. |
||
62 | * @param Commit commit object |
||
63 | */ |
||
64 | 1 | public function addCommit(Commit $commit) |
|
70 | |||
71 | /** |
||
72 | * Appends commits along with comments. |
||
73 | * @param Commit[] array of commits |
||
74 | */ |
||
75 | 1 | public function addCommits(array $commits) |
|
76 | { |
||
77 | 1 | foreach ($commits as $commit) { |
|
78 | 1 | $this->addCommit($commit); |
|
79 | } |
||
80 | 1 | } |
|
81 | |||
82 | /** |
||
83 | * Returns commits. |
||
84 | * @return Commit[] |
||
85 | */ |
||
86 | 3 | public function getCommits() |
|
90 | |||
91 | public function setNote($value) |
||
95 | |||
96 | 3 | public function getNote() |
|
100 | } |
||
101 |