Platformsh\Cli\Helper\GitHelper::getConfig PHP Method

getConfig() public method

Read a configuration item.
public getConfig ( string $key, string | null $dir = null, boolean $mustRun = false ) : string | false
$key string A Git configuration key.
$dir string | null The path to a Git repository.
$mustRun boolean Enable exceptions if the Git command fails.
return string | false
    public function getConfig($key, $dir = null, $mustRun = false)
    {
        $args = ['config', '--get', $key];
        return $this->execute($args, $dir, $mustRun);
    }

Usage Example

Esempio n. 1
0
 /**
  * Test GitHelper::getConfig().
  */
 public function testGetConfig()
 {
     $email = '*****@*****.**';
     $repository = $this->getRepositoryDir();
     chdir($repository);
     shell_exec('git config user.email ' . $email);
     $config = $this->gitHelper->getConfig('user.email', $repository);
     $this->assertEquals($email, $config);
 }
All Usage Examples Of Platformsh\Cli\Helper\GitHelper::getConfig