function InitCommand::getGitConfig
Return value
array<string, string>
1 call to InitCommand::getGitConfig()
- InitCommand::interact in vendor/
composer/ composer/ src/ Composer/ Command/ InitCommand.php - @inheritDoc
File
-
vendor/
composer/ composer/ src/ Composer/ Command/ InitCommand.php, line 533
Class
- InitCommand
- @author Justin Rainbow <justin.rainbow@gmail.com> @author Jordi Boggiano <j.boggiano@seld.be>
Namespace
Composer\CommandCode
protected function getGitConfig() : array {
if (null !== $this->gitConfig) {
return $this->gitConfig;
}
$process = new ProcessExecutor($this->getIO());
if (0 === $process->execute([
'git',
'config',
'-l',
], $output)) {
$this->gitConfig = [];
Preg::matchAllStrictGroups('{^([^=]+)=(.*)$}m', $output, $matches);
foreach ($matches[1] as $key => $match) {
$this->gitConfig[$match] = $matches[2][$key];
}
return $this->gitConfig;
}
return $this->gitConfig = [];
}