1 | <?php |
||
23 | class Repository |
||
24 | { |
||
25 | /** |
||
26 | * Path to git repository root. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | private $root; |
||
31 | |||
32 | /** |
||
33 | * Path to .git directory |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | private $dotGitDir; |
||
38 | |||
39 | /** |
||
40 | * Commit message. |
||
41 | * |
||
42 | * @var \SebastianFeldmann\Git\CommitMessage |
||
43 | */ |
||
44 | private $commitMsg; |
||
45 | |||
46 | /** |
||
47 | * @var \SebastianFeldmann\Cli\Command\Runner |
||
48 | */ |
||
49 | private $runner; |
||
50 | |||
51 | /** |
||
52 | * Map of operators |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | private $operator = []; |
||
57 | |||
58 | /** |
||
59 | * Repository constructor. |
||
60 | * |
||
61 | * @param string $root |
||
62 | * @param \SebastianFeldmann\Cli\Command\Runner $runner |
||
63 | */ |
||
64 | 10 | public function __construct(string $root = '', Runner $runner = null) |
|
75 | |||
76 | /** |
||
77 | * Root path getter. |
||
78 | * |
||
79 | * @return string |
||
80 | */ |
||
81 | 1 | public function getRoot(): string |
|
85 | |||
86 | /** |
||
87 | * Returns the path to the hooks directory. |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | 2 | public function getHooksDir(): string |
|
95 | |||
96 | /** |
||
97 | * Check for a hook file. |
||
98 | * |
||
99 | * @param string $hook |
||
100 | * |
||
101 | * @return bool |
||
102 | */ |
||
103 | 1 | public function hookExists($hook): bool |
|
107 | |||
108 | /** |
||
109 | * CommitMessage setter. |
||
110 | * |
||
111 | * @param \SebastianFeldmann\Git\CommitMessage $commitMsg |
||
112 | */ |
||
113 | 1 | public function setCommitMsg(CommitMessage $commitMsg) |
|
117 | |||
118 | /** |
||
119 | * CommitMessage getter. |
||
120 | * |
||
121 | * @return \SebastianFeldmann\Git\CommitMessage |
||
122 | */ |
||
123 | 2 | public function getCommitMsg(): CommitMessage |
|
131 | |||
132 | /** |
||
133 | * Is there a merge in progress. |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | 2 | public function isMerging(): bool |
|
147 | |||
148 | /** |
||
149 | * Get index operator. |
||
150 | * |
||
151 | * @return \SebastianFeldmann\Git\Operator\Index |
||
152 | */ |
||
153 | 1 | public function getIndexOperator(): Operator\Index |
|
157 | |||
158 | /** |
||
159 | * Get log operator. |
||
160 | * |
||
161 | * @return \SebastianFeldmann\Git\Operator\Log |
||
162 | */ |
||
163 | 1 | public function getLogOperator(): Operator\Log |
|
167 | |||
168 | /** |
||
169 | * Get config operator. |
||
170 | * |
||
171 | * @return \SebastianFeldmann\Git\Operator\Config |
||
172 | */ |
||
173 | 1 | public function getConfigOperator(): Operator\Config |
|
177 | |||
178 | /** |
||
179 | * Return requested operator. |
||
180 | * |
||
181 | * @param string $name |
||
182 | * |
||
183 | * @return mixed |
||
184 | */ |
||
185 | 3 | private function getOperator(string $name) |
|
194 | } |
||
195 |