/**
  * Wrapper function to run shell commands. Supports local and remote commands
  * depending on the gitEnvironment details.
  *
  * @param string $command      command to run
  * @param bool   $cacheCommand command to run
  * @param bool   $trim         do not trim response. Maybe need for some command responses
  *
  * @return string Result of command
  *
  * @throws \RuntimeException
  */
 public function runCommand($command, $cacheCommand = true, $trim = true)
 {
     $response = '';
     if ($this->stopwatch) {
         $this->stopwatch->start('git_request', 'version_control');
     }
     $fullCommand = sprintf('cd %s && %s', $this->gitPath, $command);
     $cacheId = md5($this->gitEnvironment->getId() . $fullCommand);
     if ($this->gitEnvironment->getSsh() === true) {
         //Run remote command over ssh
         if ($cacheCommand === true) {
             $response = $this->cache->fetch($cacheId);
             if ($response === false) {
                 $response = $this->runRemoteCommand($fullCommand);
                 $this->cache->save($cacheId, $response);
             }
         } else {
             $response = $this->runRemoteCommand($fullCommand);
         }
     } else {
         //Run local commands
         $start = microtime(true);
         $response = $this->runLocalCommand($command);
         $this->logCommand($fullCommand, 'local', array(), $start);
     }
     return $trim === true ? trim($response) : $response;
 }