Total Complexity | 8 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 6 | ||
Bugs | 2 | Features | 1 |
1 | <?php |
||
14 | class Git extends Executable |
||
15 | { |
||
16 | /** @var array */ |
||
17 | protected $gitConfig; |
||
18 | |||
19 | /** @var string The binary executable */ |
||
20 | protected $binary = 'git'; |
||
21 | |||
22 | /** |
||
23 | * Gets git config. |
||
24 | * |
||
25 | * @param string|null $key |
||
26 | * |
||
27 | * @return mixed |
||
28 | */ |
||
29 | public function getConfig($key = null) |
||
40 | } |
||
41 | |||
42 | protected function loadConfig() |
||
43 | { |
||
44 | $gitConfig = []; |
||
45 | |||
46 | $output = $this->runCommand('config --list'); |
||
47 | $output = explode("\n", str_replace(["\r\n", "\r"], "\n", $output)); |
||
48 | |||
49 | foreach ($output as $config) { |
||
50 | $parts = array_map('trim', explode('=', $config, 2)) + ['', '']; |
||
51 | |||
52 | $gitConfig[$parts[0]] = $parts[1]; |
||
53 | } |
||
54 | |||
55 | $this->gitConfig = $gitConfig; |
||
56 | } |
||
57 | |||
58 | public function init() |
||
59 | { |
||
60 | $this->runCommand('init'); |
||
61 | |||
62 | return $this; |
||
63 | } |
||
64 | |||
65 | public function addRemote($username, $project) |
||
70 | } |
||
71 | } |
||
72 |