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 | * Executes cli commands. |
||
47 | * |
||
48 | * @var \SebastianFeldmann\Cli\Command\Runner |
||
49 | */ |
||
50 | private $runner; |
||
51 | |||
52 | /** |
||
53 | * Map of operators |
||
54 | * |
||
55 | * @var array |
||
56 | */ |
||
57 | private $operator = []; |
||
58 | |||
59 | /** |
||
60 | * Repository constructor. |
||
61 | * |
||
62 | * @param string $root |
||
63 | * @param \SebastianFeldmann\Cli\Command\Runner $runner |
||
64 | */ |
||
65 | 11 | public function __construct(string $root = '', Runner $runner = null) |
|
76 | |||
77 | /** |
||
78 | * Root path getter. |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 1 | public function getRoot() : string |
|
86 | |||
87 | /** |
||
88 | * Returns the path to the hooks directory. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 2 | public function getHooksDir() : string |
|
96 | |||
97 | /** |
||
98 | * Check for a hook file. |
||
99 | * |
||
100 | * @param string $hook |
||
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 |
|
130 | |||
131 | /** |
||
132 | * Is there a merge in progress. |
||
133 | * |
||
134 | * @return bool |
||
135 | */ |
||
136 | 2 | public function isMerging() : bool |
|
145 | |||
146 | /** |
||
147 | * Get index operator. |
||
148 | * |
||
149 | * @return \SebastianFeldmann\Git\Operator\Index |
||
150 | */ |
||
151 | 1 | public function getIndexOperator() : Operator\Index |
|
155 | |||
156 | /** |
||
157 | * Get info operator. |
||
158 | * |
||
159 | * @return \SebastianFeldmann\Git\Operator\Info |
||
160 | */ |
||
161 | 1 | public function getInfoOperator() : Operator\Info |
|
165 | |||
166 | /** |
||
167 | * Get log operator. |
||
168 | * |
||
169 | * @return \SebastianFeldmann\Git\Operator\Log |
||
170 | */ |
||
171 | 1 | public function getLogOperator() : Operator\Log |
|
175 | |||
176 | /** |
||
177 | * Get config operator. |
||
178 | * |
||
179 | * @return \SebastianFeldmann\Git\Operator\Config |
||
180 | */ |
||
181 | 1 | public function getConfigOperator() : Operator\Config |
|
185 | |||
186 | /** |
||
187 | * Return requested operator. |
||
188 | * |
||
189 | * @param string $name |
||
190 | * @return mixed |
||
191 | */ |
||
192 | 4 | private function getOperator(string $name) |
|
200 | } |
||
201 |