1 | <?php |
||
28 | abstract class AbstractCommand extends BaseCommand |
||
29 | { |
||
30 | |||
31 | /** |
||
32 | * Raw path. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $_rawPath; |
||
37 | |||
38 | /** |
||
39 | * Whatever "path" argument accepts repository urls. |
||
40 | * |
||
41 | * @var boolean |
||
42 | */ |
||
43 | protected $pathAcceptsUrl = false; |
||
44 | |||
45 | /** |
||
46 | * Repository connector |
||
47 | * |
||
48 | * @var Connector |
||
49 | */ |
||
50 | protected $repositoryConnector; |
||
51 | |||
52 | /** |
||
53 | * Working directory. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $workingDirectory = null; |
||
58 | |||
59 | /** |
||
60 | * Working copy resolver. |
||
61 | * |
||
62 | * @var WorkingCopyResolver |
||
63 | */ |
||
64 | private $_workingCopyResolver = null; |
||
65 | |||
66 | /** |
||
67 | * Revision log factory. |
||
68 | * |
||
69 | * @var RevisionLogFactory |
||
70 | */ |
||
71 | private $_revisionLogFactory; |
||
72 | |||
73 | /** |
||
74 | * Config editor. |
||
75 | * |
||
76 | * @var ConfigEditor |
||
77 | */ |
||
78 | private $_configEditor; |
||
79 | |||
80 | /** |
||
81 | * {@inheritdoc} |
||
82 | * |
||
83 | * @throws \RuntimeException When url was given instead of path. |
||
84 | */ |
||
85 | protected function initialize(InputInterface $input, OutputInterface $output) |
||
96 | |||
97 | /** |
||
98 | * Prepare dependencies. |
||
99 | * |
||
100 | * @return void |
||
101 | */ |
||
102 | protected function prepareDependencies() |
||
114 | |||
115 | /** |
||
116 | * Returns command setting value. |
||
117 | * |
||
118 | * @param string $name Name. |
||
119 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
120 | * |
||
121 | * @return mixed |
||
122 | */ |
||
123 | protected function getSetting($name, $command_name = null) |
||
127 | |||
128 | /** |
||
129 | * Sets command setting value. |
||
130 | * |
||
131 | * @param string $name Name. |
||
132 | * @param mixed $value Value. |
||
133 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
134 | * |
||
135 | * @return void |
||
136 | */ |
||
137 | protected function setSetting($name, $value, $command_name = null) |
||
141 | |||
142 | /** |
||
143 | * Validates command setting usage. |
||
144 | * |
||
145 | * @param string $name Name. |
||
146 | * @param string|null $command_name Command name to get settings from instead of current command. |
||
147 | * |
||
148 | * @return AbstractConfigSetting |
||
149 | * @throws \LogicException When command don't have any config settings to provide. |
||
150 | * @throws \LogicException When config setting is not found. |
||
151 | */ |
||
152 | private function _getConfigSetting($name, $command_name = null) |
||
180 | |||
181 | /** |
||
182 | * Prepare setting prefix. |
||
183 | * |
||
184 | * @param boolean $is_global Return global setting prefix. |
||
185 | * |
||
186 | * @return string |
||
187 | * @todo Possibly not in use. |
||
188 | */ |
||
189 | protected function getConfigScope($is_global) |
||
197 | |||
198 | /** |
||
199 | * Returns revision log. |
||
200 | * |
||
201 | * @param string $repository_url Repository url. |
||
202 | * |
||
203 | * @return RevisionLog |
||
204 | */ |
||
205 | protected function getRevisionLog($repository_url) |
||
209 | |||
210 | /** |
||
211 | * Transforms string into list. |
||
212 | * |
||
213 | * @param string $string String. |
||
214 | * @param string $separator Separator. |
||
215 | * |
||
216 | * @return array |
||
217 | */ |
||
218 | protected function getList($string, $separator = ',') |
||
222 | |||
223 | /** |
||
224 | * Returns URL to the working copy. |
||
225 | * |
||
226 | * @return string |
||
227 | */ |
||
228 | protected function getWorkingCopyUrl() |
||
232 | |||
233 | /** |
||
234 | * Return working copy path. |
||
235 | * |
||
236 | * @return string |
||
237 | */ |
||
238 | protected function getWorkingCopyPath() |
||
242 | |||
243 | /** |
||
244 | * Returns all refs. |
||
245 | * |
||
246 | * @return array |
||
247 | */ |
||
248 | protected function getAllRefs() |
||
255 | |||
256 | /** |
||
257 | * Returns working copy path as used specified it. |
||
258 | * |
||
259 | * @return string |
||
260 | */ |
||
261 | protected function getRawPath() |
||
275 | |||
276 | } |
||
277 |