Completed
Push — master ( 751a3d...b7ca33 )
by Sebastian
17:18 queued 15:56
created

Commit::getNames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of SebastianFeldmann\Git.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\Git\Log;
11
12
/**
13
 * Class Commit
14
 *
15
 * @package SebastianFeldmann\Git
16
 * @author  Sebastian Feldmann <[email protected]>
17
 * @link    https://github.com/sebastianfeldmann/git
18
 * @since   Class available since Release 1.2.0
19
 */
20
class Commit
21
{
22
    /**
23
     * @var string
24
     */
25
    private $hash;
26
27
    /**
28
     * @var array
29
     */
30
    private $names;
31
32
    /**
33
     * @var string
34
     */
35
    private $description;
36
37
    /**
38
     * @var \DateTimeImmutable
39
     */
40
    private $date;
41
42
    /**
43
     * @var string
44
     */
45
    private $author;
46
47
    /**
48
     * Commit constructor.
49
     *
50
     * @param string             $hash
51
     * @param array              $names
52
     * @param string             $description
53
     * @param \DateTimeImmutable $date
54
     * @param string             $author
55
     */
56 4
    public function __construct(
57
        string $hash,
58
        array $names,
59
        string $description,
60
        \DateTimeImmutable $date,
61
        string $author
62
    )
63
    {
64 4
        $this->hash        = $hash;
65 4
        $this->names       = $names;
66 4
        $this->description = $description;
67 4
        $this->date        = $date;
68 4
        $this->author      = $author;
69 4
    }
70
71
    /**
72
     * Hash getter.
73
     *
74
     * @return string
75
     */
76 2
    public function getHash(): string
77
    {
78 2
        return $this->hash;
79
    }
80
81
    /**
82
     * Does the commit have names.
83
     *
84
     * @return bool
85
     */
86 1
    public function hasNames(): bool
87
    {
88 1
        return !empty($this->names);
89
    }
90
91
    /**
92
     * Names getter.
93
     *
94
     * @return array
95
     */
96 1
    public function getNames(): array
97
    {
98 1
        return $this->names;
99
    }
100
101
    /**
102
     * Description getter.
103
     *
104
     * @return string
105
     */
106 1
    public function getDescription(): string
107
    {
108 1
        return $this->description;
109
    }
110
111
    /**
112
     * Date getter.
113
     *
114
     * @return \DateTimeImmutable
115
     */
116 1
    public function getDate(): \DateTimeImmutable
117
    {
118 1
        return $this->date;
119
    }
120
121
    /**
122
     * Author getter.
123
     *
124
     * @return string
125
     */
126 4
    public function getAuthor(): string
127
    {
128 4
        return $this->author;
129
    }
130
}
131