MarkdownRenderer::renderNote()   A
last analyzed

Complexity

Conditions 4
Paths 5

Size

Total Lines 15
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
cc 4
eloc 9
nc 5
nop 1
dl 0
loc 15
ccs 0
cts 14
cp 0
crap 20
rs 9.9666
c 0
b 0
f 0
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\lib\changelog;
12
13
use hiqdev\chkipper\lib\Note;
14
15
/**
16
 * Markdown changelog renderer.
17
 *
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class MarkdownRenderer extends \hiqdev\chkipper\lib\renderers\MarkdownRenderer
21
{
22
    protected $normalization = Normalization::class;
23
24
    public function renderNote(Note $note)
25
    {
26
        $str = $this->renderNoteHead($note);
27
        if (!$str) {
28
            return;
29
        }
30
        $authors = [];
31
        foreach ($note->getCommits() as $commit) {
32
            $authors[$commit->getAuthor()] = '[' . $commit->getAuthor() . ']';
33
        }
34
        if ($authors) {
35
            $str .= ' (' . implode(', ', $authors) . ')';
36
        }
37
38
        return $str;
39
    }
40
}
41