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 string |
||
62 | */ |
||
63 | private $_workingCopyPaths = array(); |
||
64 | |||
65 | /** |
||
66 | * Revision log factory. |
||
67 | * |
||
68 | * @var RevisionLogFactory |
||
69 | */ |
||
70 | private $_revisionLogFactory; |
||
71 | |||
72 | /** |
||
73 | * Config editor. |
||
74 | * |
||
75 | * @var ConfigEditor |
||
76 | */ |
||
77 | private $_configEditor; |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | protected function initialize(InputInterface $input, OutputInterface $output) |
||
88 | |||
89 | /** |
||
90 | * Prepare dependencies. |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | protected function prepareDependencies() |
||
105 | |||
106 | /** |
||
107 | * Returns command setting value. |
||
108 | * |
||
109 | * @param string $name Name. |
||
110 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
111 | * |
||
112 | * @return mixed |
||
113 | */ |
||
114 | protected function getSetting($name, $command_name = null) |
||
118 | |||
119 | /** |
||
120 | * Sets command setting value. |
||
121 | * |
||
122 | * @param string $name Name. |
||
123 | * @param mixed $value Value. |
||
124 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
125 | * |
||
126 | * @return void |
||
127 | */ |
||
128 | protected function setSetting($name, $value, $command_name = null) |
||
132 | |||
133 | /** |
||
134 | * Validates command setting usage. |
||
135 | * |
||
136 | * @param string $name Name. |
||
137 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
138 | * |
||
139 | * @return AbstractConfigSetting |
||
140 | * @throws \LogicException When command don't have any config settings to provide. |
||
141 | * @throws \LogicException When config setting is not found. |
||
142 | */ |
||
143 | private function _getConfigSetting($name, $command_name = null) |
||
171 | |||
172 | /** |
||
173 | * Prepare setting prefix. |
||
174 | * |
||
175 | * @param boolean $is_global Return global setting prefix. |
||
176 | * |
||
177 | * @return string |
||
178 | */ |
||
179 | protected function getConfigScope($is_global) |
||
187 | |||
188 | /** |
||
189 | * Returns revision log. |
||
190 | * |
||
191 | * @param string $repository_url Repository url. |
||
192 | * |
||
193 | * @return RevisionLog |
||
194 | */ |
||
195 | protected function getRevisionLog($repository_url) |
||
206 | |||
207 | /** |
||
208 | * Transforms string into list. |
||
209 | * |
||
210 | * @param string $string String. |
||
211 | * @param string $separator Separator. |
||
212 | * |
||
213 | * @return array |
||
214 | */ |
||
215 | protected function getList($string, $separator = ',') |
||
219 | |||
220 | /** |
||
221 | * Returns URL to the working copy. |
||
222 | * |
||
223 | * @return string |
||
224 | */ |
||
225 | protected function getWorkingCopyUrl() |
||
229 | |||
230 | /** |
||
231 | * Return working copy path. |
||
232 | * |
||
233 | * @return string |
||
234 | * @throws \RuntimeException When folder isn't a working copy. |
||
235 | */ |
||
236 | protected function getWorkingCopyPath() |
||
252 | |||
253 | /** |
||
254 | * Returns all refs. |
||
255 | * |
||
256 | * @return array |
||
257 | */ |
||
258 | protected function getAllRefs() |
||
265 | |||
266 | /** |
||
267 | * Return working copy path. |
||
268 | * |
||
269 | * @return string |
||
270 | * @throws \RuntimeException When url was given instead of path. |
||
271 | */ |
||
272 | protected function getPath() |
||
295 | |||
296 | } |
||
297 |