Total Complexity | 6 |
Total Lines | 87 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
24 | class PrePush implements Rev |
||
25 | { |
||
26 | /** |
||
27 | * Head path - refs/heads/main |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | private string $head; |
||
32 | |||
33 | /** |
||
34 | * Git hash |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private string $hash; |
||
39 | |||
40 | /** |
||
41 | * Branch name |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | private string $branch; |
||
46 | |||
47 | /** |
||
48 | * Constructor |
||
49 | * |
||
50 | * @param string $head |
||
51 | * @param string $hash |
||
52 | * @param string $branch |
||
53 | */ |
||
54 | 14 | public function __construct(string $head, string $hash, string $branch) |
|
55 | { |
||
56 | 14 | $this->head = $head; |
|
57 | 14 | $this->hash = $hash; |
|
58 | 14 | $this->branch = $branch; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * Head getter |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | 1 | public function head(): string |
|
67 | { |
||
68 | 1 | return $this->head; |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * Hash getter |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | 1 | public function hash(): string |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * Branch getter |
||
83 | * |
||
84 | * @return string |
||
85 | */ |
||
86 | 9 | public function branch(): string |
|
87 | { |
||
88 | 9 | return $this->branch; |
|
89 | } |
||
90 | |||
91 | /** |
||
92 | * Returns the ref id that can be used in a git command |
||
93 | * |
||
94 | * This can be completely different thing hash, branch name, ref-log position... |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 10 | public function id(): string |
|
101 | } |
||
102 | |||
103 | /** |
||
104 | * Is this a git dummy hash |
||
105 | * |
||
106 | * @return bool |
||
107 | */ |
||
108 | 7 | public function isZeroRev(): bool |
|
111 | } |
||
112 | } |
||
113 |