original_string: protected function command($command, $repoPath = null)
      {
          if (!$repoPath) {
              $repoPath = $this->repo;
          }
  
          $command = 'git --git-dir="'.$repoPath.'/.git" --work-tree="'.$repoPath.'" '.$command;
  
          exec(escapeshellcmd($command), $output, $returnStatus);
  
          if ($returnStatus != 0) {
              throw new Exception("The following command was attempted but failed:\r\n$command");
          }
  
          return $output;
      }
code: protected function command($command, $repoPath = null)
      {
          if (!$repoPath) {
              $repoPath = $this->repo;
          }
  
          $command = 'git --git-dir="'.$repoPath.'/.git" --work-tree="'.$repoPath.'" '.$command;
  
          exec(escapeshellcmd($command), $output, $returnStatus);
  
          if ($returnStatus != 0) {
              throw new Exception("The following command was attempted but failed:\r\n$command");
          }
  
          return $output;
      }
code_tokens: protected function command ( $ command , $ repoPath = null ) { if ( ! $ repoPath ) { $ repoPath = $ this -> repo ; } $ command = 'git --git-dir="' . $ repoPath . '/.git" --work-tree="' . $ repoPath . '" ' . $ command ; exec ( escapeshellcmd ( $ command ) , $ output , $ returnStatus ) ; if ( $ returnStatus != 0 ) { throw new Exception ( "The following command was attempted but failed:\r\n$command" ) ; } return $ output ; }
docstring: Runs a Git command.
  
  @param string $command
  @param null|string $repoPath
  @throws Exception if command fails
  @return array
docstring_tokens: Runs a Git command .