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