Completed
Push — master ( aaccd5...c6e65b )
by Jonathan
10s
created

Issue::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ChangelogGenerator;
6
7
use function sprintf;
8
9
class Issue
10
{
11
    private const ISSUE_LINE_FORMAT = ' - [%d: %s](%s) thanks to @%s';
12
13
    /** @var int */
14
    private $number;
15
16
    /** @var string */
17
    private $title;
18
19
    /** @var string */
20
    private $url;
21
22
    /** @var string */
23
    private $user;
24
25
    /** @var string[] */
26
    private $labels = [];
27
28
    /**
29
     * @param string[] $labels
30
     */
31 7
    public function __construct(int $number, string $title, string $url, string $user, array $labels)
32
    {
33 7
        $this->number = $number;
34 7
        $this->title  = $title;
35 7
        $this->url    = $url;
36 7
        $this->user   = $user;
37 7
        $this->labels = $labels;
38 7
    }
39
40 2
    public function getNumber() : int
41
    {
42 2
        return $this->number;
43
    }
44
45 2
    public function getTitle() : string
46
    {
47 2
        return $this->title;
48
    }
49
50 2
    public function getUrl() : string
51
    {
52 2
        return $this->url;
53
    }
54
55 2
    public function getUser() : string
56
    {
57 2
        return $this->user;
58
    }
59
60
    /**
61
     * @return string[]
62
     */
63 2
    public function getLabels() : array
64
    {
65 2
        return $this->labels;
66
    }
67
68 1
    public function render() : string
69
    {
70 1
        return sprintf(
71 1
            self::ISSUE_LINE_FORMAT,
72 1
            $this->number,
73 1
            $this->title,
74 1
            $this->url,
75 1
            $this->user
76
        );
77
    }
78
}
79