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 | 9 | 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 | * @return bool |
||
100 | */ |
||
101 | 1 | public function hookExists($hook) : bool |
|
105 | |||
106 | /** |
||
107 | * CommitMessage setter. |
||
108 | * |
||
109 | * @param \SebastianFeldmann\Git\CommitMessage $commitMsg |
||
110 | */ |
||
111 | 1 | public function setCommitMsg(CommitMessage $commitMsg) |
|
115 | |||
116 | /** |
||
117 | * CommitMessage getter. |
||
118 | * |
||
119 | * @return \SebastianFeldmann\Git\CommitMessage |
||
120 | */ |
||
121 | 2 | public function getCommitMsg() : CommitMessage |
|
128 | |||
129 | /** |
||
130 | * Is there a merge in progress. |
||
131 | * |
||
132 | * @return bool |
||
133 | */ |
||
134 | 2 | public function isMerging() : bool |
|
143 | |||
144 | /** |
||
145 | * Get index operator. |
||
146 | * |
||
147 | * @return \SebastianFeldmann\Git\Operator\Index |
||
148 | */ |
||
149 | 1 | public function getIndexOperator() : Operator\Index |
|
153 | |||
154 | /** |
||
155 | * Get log operator. |
||
156 | * |
||
157 | * @return \SebastianFeldmann\Git\Operator\Log |
||
158 | */ |
||
159 | 1 | public function getLogOperator() : Operator\Log |
|
163 | |||
164 | /** |
||
165 | * Return requested operator. |
||
166 | * |
||
167 | * @param string $name |
||
168 | * @return mixed |
||
169 | */ |
||
170 | 2 | private function getOperator(string $name) |
|
178 | } |
||
179 |