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 | 9 | */ |
|
64 | public function __construct(string $root = '', Runner $runner = null) |
||
75 | |||
76 | /** |
||
77 | * Root path getter. |
||
78 | * |
||
79 | * @return string |
||
80 | 1 | */ |
|
81 | public function getRoot(): string |
||
85 | |||
86 | /** |
||
87 | * Returns the path to the hooks directory. |
||
88 | * |
||
89 | * @return string |
||
90 | 2 | */ |
|
91 | public function getHooksDir(): string |
||
95 | |||
96 | /** |
||
97 | * Check for a hook file. |
||
98 | * |
||
99 | * @param string $hook |
||
100 | * |
||
101 | 1 | * @return bool |
|
102 | */ |
||
103 | 1 | public function hookExists($hook): bool |
|
107 | |||
108 | /** |
||
109 | * CommitMessage setter. |
||
110 | * |
||
111 | 1 | * @param \SebastianFeldmann\Git\CommitMessage $commitMsg |
|
112 | */ |
||
113 | 1 | public function setCommitMsg(CommitMessage $commitMsg) |
|
117 | |||
118 | /** |
||
119 | * CommitMessage getter. |
||
120 | * |
||
121 | 2 | * @return \SebastianFeldmann\Git\CommitMessage |
|
122 | */ |
||
123 | 2 | public function getCommitMsg(): CommitMessage |
|
131 | |||
132 | /** |
||
133 | * Is there a merge in progress. |
||
134 | 2 | * |
|
135 | * @return bool |
||
136 | 2 | */ |
|
137 | 2 | public function isMerging(): bool |
|
147 | |||
148 | /** |
||
149 | 1 | * Get index operator. |
|
150 | * |
||
151 | 1 | * @return \SebastianFeldmann\Git\Operator\Index |
|
152 | */ |
||
153 | public function getIndexOperator(): Operator\Index |
||
157 | |||
158 | /** |
||
159 | 1 | * Get log operator. |
|
160 | * |
||
161 | 1 | * @return \SebastianFeldmann\Git\Operator\Log |
|
162 | */ |
||
163 | public function getLogOperator(): Operator\Log |
||
167 | |||
168 | /** |
||
169 | * Return requested operator. |
||
170 | 2 | * |
|
171 | * @param string $name |
||
172 | 2 | * |
|
173 | 2 | * @return mixed |
|
174 | 2 | */ |
|
175 | private function getOperator(string $name) |
||
184 | |||
185 | |||
186 | /** |
||
187 | * Get the repository configuration |
||
188 | * |
||
189 | * @return \SebastianFeldmann\Git\Operator\Config |
||
190 | */ |
||
191 | public function getConfig(): Operator\Config |
||
195 | } |
||
196 |