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

Issue   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 67
rs 10
c 0
b 0
f 0
ccs 24
cts 24
cp 1
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getUrl() 0 3 1
A getLabels() 0 3 1
A getUser() 0 3 1
A __construct() 0 7 1
A getTitle() 0 3 1
A getNumber() 0 3 1
A render() 0 8 1
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