| Total Complexity | 8 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class Git extends Executable |
||
| 6 | { |
||
| 7 | /** @var array */ |
||
| 8 | protected $gitConfig; |
||
| 9 | |||
| 10 | /** @var string The binary executable */ |
||
| 11 | protected $binary = 'git'; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Gets git config. |
||
| 15 | * |
||
| 16 | * @param string|null $key |
||
| 17 | * |
||
| 18 | * @return mixed |
||
| 19 | */ |
||
| 20 | public function getConfig($key = null) |
||
| 31 | } |
||
| 32 | |||
| 33 | protected function loadConfig() |
||
| 34 | { |
||
| 35 | $gitConfig = []; |
||
| 36 | |||
| 37 | $output = $this->runCommand('config --list'); |
||
| 38 | $output = explode("\n", str_replace(["\r\n", "\r"], "\n", $output)); |
||
| 39 | |||
| 40 | foreach ($output as $config) { |
||
| 41 | $parts = array_map('trim', explode('=', $config, 2)) + ['', '']; |
||
| 42 | |||
| 43 | $gitConfig[$parts[0]] = $parts[1]; |
||
| 44 | } |
||
| 45 | |||
| 46 | $this->gitConfig = $gitConfig; |
||
| 47 | } |
||
| 48 | |||
| 49 | public function init() |
||
| 50 | { |
||
| 51 | $this->runCommand('init'); |
||
| 52 | |||
| 53 | return $this; |
||
| 54 | } |
||
| 55 | |||
| 56 | public function addRemote($username, $project) |
||
| 61 | } |
||
| 62 | } |
||
| 63 |