| 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 | /** |
||
|
2 ignored issues
–
show
|
|||
| 80 | * {@inheritdoc} |
||
|
1 ignored issue
–
show
|
|||
| 81 | */ |
||
|
1 ignored issue
–
show
|
|||
| 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) |
||
| 191 | |||
| 192 | /** |
||
| 193 | * Returns revision log. |
||
| 194 | * |
||
| 195 | * @param string $repository_url Repository url. |
||
| 196 | * |
||
| 197 | * @return RevisionLog |
||
| 198 | */ |
||
| 199 | protected function getRevisionLog($repository_url) |
||
| 210 | |||
| 211 | /** |
||
| 212 | * Transforms string into list. |
||
| 213 | * |
||
| 214 | * @param string $string String. |
||
| 215 | * @param string $separator Separator. |
||
| 216 | * |
||
| 217 | * @return array |
||
| 218 | */ |
||
| 219 | protected function getList($string, $separator = ',') |
||
| 223 | |||
| 224 | /** |
||
| 225 | * Returns URL to the working copy. |
||
| 226 | * |
||
| 227 | * @return string |
||
| 228 | */ |
||
| 229 | protected function getWorkingCopyUrl() |
||
| 233 | |||
| 234 | /** |
||
| 235 | * Return working copy path. |
||
| 236 | * |
||
| 237 | * @return string |
||
| 238 | * @throws \RuntimeException When folder isn't a working copy. |
||
| 239 | */ |
||
| 240 | protected function getWorkingCopyPath() |
||
| 256 | |||
| 257 | /** |
||
| 258 | * Returns all refs. |
||
| 259 | * |
||
| 260 | * @return array |
||
| 261 | */ |
||
| 262 | protected function getAllRefs() |
||
| 269 | |||
| 270 | /** |
||
| 271 | * Return working copy path. |
||
| 272 | * |
||
| 273 | * @return string |
||
| 274 | * @throws \RuntimeException When url was given instead of path. |
||
| 275 | */ |
||
| 276 | protected function getPath() |
||
| 295 | |||
| 296 | } |
||
| 297 |