1 | <?php |
||
24 | abstract class AbstractCommand extends BaseCommand |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Whatever "path" argument accepts repository urls. |
||
29 | * |
||
30 | * @var boolean |
||
31 | */ |
||
32 | protected $pathAcceptsUrl = false; |
||
33 | |||
34 | /** |
||
35 | * Repository connector |
||
36 | * |
||
37 | * @var Connector |
||
38 | */ |
||
39 | protected $repositoryConnector; |
||
40 | |||
41 | /** |
||
42 | * Working directory. |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $workingDirectory = null; |
||
47 | |||
48 | /** |
||
49 | * Revision logs by url |
||
50 | * |
||
51 | * @var RevisionLog[] |
||
52 | */ |
||
53 | private $_revisionLogs = array(); |
||
54 | |||
55 | /** |
||
56 | * Working copy paths. |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | private $_workingCopyPaths = array(); |
||
61 | |||
62 | /** |
||
63 | * Revision log factory. |
||
64 | * |
||
65 | * @var RevisionLogFactory |
||
66 | */ |
||
67 | private $_revisionLogFactory; |
||
68 | |||
69 | /** |
||
70 | * Config editor. |
||
71 | * |
||
72 | * @var ConfigEditor |
||
73 | */ |
||
74 | private $_configEditor; |
||
75 | |||
76 | /** |
||
77 | * Prepare dependencies. |
||
78 | * |
||
79 | * @return void |
||
80 | */ |
||
81 | protected function prepareDependencies() |
||
92 | |||
93 | /** |
||
94 | * Returns command setting value. |
||
95 | * |
||
96 | * @param string $name Name. |
||
97 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | protected function getSetting($name, $command_name = null) |
||
105 | |||
106 | /** |
||
107 | * Sets command setting value. |
||
108 | * |
||
109 | * @param string $name Name. |
||
110 | * @param mixed $value Value. |
||
111 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
112 | * |
||
113 | * @return void |
||
114 | */ |
||
115 | protected function setSetting($name, $value, $command_name = null) |
||
119 | |||
120 | /** |
||
121 | * Validates command setting usage. |
||
122 | * |
||
123 | * @param string $name Name. |
||
124 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
125 | * |
||
126 | * @return AbstractConfigSetting |
||
127 | * @throws \LogicException When command don't have any config settings to provide. |
||
128 | * @throws \LogicException When config setting is not found. |
||
129 | */ |
||
130 | private function _getConfigSetting($name, $command_name = null) |
||
158 | |||
159 | /** |
||
160 | * Prepare setting prefix. |
||
161 | * |
||
162 | * @param boolean $is_global Return global setting prefix. |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | protected function getConfigScope($is_global) |
||
178 | |||
179 | /** |
||
180 | * Returns revision log. |
||
181 | * |
||
182 | * @param string $repository_url Repository url. |
||
183 | * |
||
184 | * @return RevisionLog |
||
185 | */ |
||
186 | protected function getRevisionLog($repository_url) |
||
194 | |||
195 | /** |
||
196 | * Transforms string into list. |
||
197 | * |
||
198 | * @param string $string String. |
||
199 | * @param string $separator Separator. |
||
200 | * |
||
201 | * @return array |
||
202 | */ |
||
203 | protected function getList($string, $separator = ',') |
||
207 | |||
208 | /** |
||
209 | * Returns URL to the working copy. |
||
210 | * |
||
211 | * @return string |
||
212 | */ |
||
213 | protected function getWorkingCopyUrl() |
||
217 | |||
218 | /** |
||
219 | * Return working copy path. |
||
220 | * |
||
221 | * @return string |
||
222 | * @throws \RuntimeException When folder isn't a working copy. |
||
223 | */ |
||
224 | protected function getWorkingCopyPath() |
||
240 | |||
241 | /** |
||
242 | * Returns all refs. |
||
243 | * |
||
244 | * @return array |
||
245 | */ |
||
246 | protected function getAllRefs() |
||
253 | |||
254 | /** |
||
255 | * Return working copy path. |
||
256 | * |
||
257 | * @return string |
||
258 | * @throws \RuntimeException When url was given instead of path. |
||
259 | */ |
||
260 | protected function getPath() |
||
279 | |||
280 | } |
||
281 |