1 | <?php |
||
27 | abstract class AbstractCommand extends BaseCommand |
||
28 | { |
||
29 | |||
30 | /** |
||
31 | * Whatever "path" argument accepts repository urls. |
||
32 | * |
||
33 | * @var boolean |
||
34 | */ |
||
35 | protected $pathAcceptsUrl = false; |
||
36 | |||
37 | /** |
||
38 | * Repository connector |
||
39 | * |
||
40 | * @var Connector |
||
41 | */ |
||
42 | protected $repositoryConnector; |
||
43 | |||
44 | /** |
||
45 | * Working directory. |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $workingDirectory = null; |
||
50 | |||
51 | /** |
||
52 | * Revision logs by url |
||
53 | * |
||
54 | * @var RevisionLog[] |
||
55 | */ |
||
56 | private $_revisionLogs = array(); |
||
57 | |||
58 | /** |
||
59 | * Working copy paths. |
||
60 | * |
||
61 | * @var array |
||
62 | */ |
||
63 | private $_workingCopyPaths = array(); |
||
64 | |||
65 | /** |
||
66 | * Mapping between working copy paths and their urls. |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | private $_workingCopyUrlMapping = array(); |
||
71 | |||
72 | /** |
||
73 | * Mapping between path to working copy specified by user to one, that is actually used. |
||
74 | * |
||
75 | * @var array |
||
76 | */ |
||
77 | private $_resolvedPathMapping = array(); |
||
78 | |||
79 | /** |
||
80 | * Revision log factory. |
||
81 | * |
||
82 | * @var RevisionLogFactory |
||
83 | */ |
||
84 | private $_revisionLogFactory; |
||
85 | |||
86 | /** |
||
87 | * Config editor. |
||
88 | * |
||
89 | * @var ConfigEditor |
||
90 | */ |
||
91 | private $_configEditor; |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | protected function initialize(InputInterface $input, OutputInterface $output) |
||
102 | |||
103 | /** |
||
104 | * Prepare dependencies. |
||
105 | * |
||
106 | * @return void |
||
107 | */ |
||
108 | protected function prepareDependencies() |
||
119 | |||
120 | /** |
||
121 | * Returns command setting value. |
||
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 mixed |
||
127 | */ |
||
128 | protected function getSetting($name, $command_name = null) |
||
132 | |||
133 | /** |
||
134 | * Sets command setting value. |
||
135 | * |
||
136 | * @param string $name Name. |
||
137 | * @param mixed $value Value. |
||
138 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
139 | * |
||
140 | * @return void |
||
141 | */ |
||
142 | protected function setSetting($name, $value, $command_name = null) |
||
146 | |||
147 | /** |
||
148 | * Validates command setting usage. |
||
149 | * |
||
150 | * @param string $name Name. |
||
151 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
152 | * |
||
153 | * @return AbstractConfigSetting |
||
154 | * @throws \LogicException When command don't have any config settings to provide. |
||
155 | * @throws \LogicException When config setting is not found. |
||
156 | */ |
||
157 | private function _getConfigSetting($name, $command_name = null) |
||
185 | |||
186 | /** |
||
187 | * Prepare setting prefix. |
||
188 | * |
||
189 | * @param boolean $is_global Return global setting prefix. |
||
190 | * |
||
191 | * @return string |
||
192 | * @todo Possibly not in use. |
||
193 | */ |
||
194 | protected function getConfigScope($is_global) |
||
202 | |||
203 | /** |
||
204 | * Returns revision log. |
||
205 | * |
||
206 | * @param string $repository_url Repository url. |
||
207 | * |
||
208 | * @return RevisionLog |
||
209 | */ |
||
210 | protected function getRevisionLog($repository_url) |
||
221 | |||
222 | /** |
||
223 | * Transforms string into list. |
||
224 | * |
||
225 | * @param string $string String. |
||
226 | * @param string $separator Separator. |
||
227 | * |
||
228 | * @return array |
||
229 | */ |
||
230 | protected function getList($string, $separator = ',') |
||
234 | |||
235 | /** |
||
236 | * Returns URL to the working copy. |
||
237 | * |
||
238 | * @return string |
||
239 | */ |
||
240 | protected function getWorkingCopyUrl() |
||
250 | |||
251 | /** |
||
252 | * Return working copy path. |
||
253 | * |
||
254 | * @return string |
||
255 | * @throws \RuntimeException When folder isn't a working copy. |
||
256 | */ |
||
257 | protected function getWorkingCopyPath() |
||
273 | |||
274 | /** |
||
275 | * Returns all refs. |
||
276 | * |
||
277 | * @return array |
||
278 | */ |
||
279 | protected function getAllRefs() |
||
286 | |||
287 | /** |
||
288 | * Return working copy path. |
||
289 | * |
||
290 | * @return string |
||
291 | * @throws \RuntimeException When url was given instead of path. |
||
292 | */ |
||
293 | protected function getPath() |
||
322 | |||
323 | } |
||
324 |