CommitRef::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Biurad opensource projects.
5
 *
6
 * @copyright 2022 Biurad Group (https://biurad.com/)
7
 * @license   https://opensource.org/licenses/BSD-3-Clause License
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Biurad\Git\Commit;
14
15
/**
16
 * A git ref of a commit containing only the hash.
17
 *
18
 * @author Divine Niiquaye Ibok <[email protected]>
19
 */
20
class CommitRef implements \Stringable
21
{
22
    private string $hash;
23
24
    public function __construct(string $commitHash, private ?int $mode = null)
25
    {
26
        $this->hash = $commitHash;
27
    }
28
29
    public function __toString(): string
30
    {
31
        return $this->hash;
32
    }
33
34
    public function getMode(): ?int
35
    {
36
        return $this->mode;
37
    }
38
}
39