Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • GitCommand
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: namespace Contrib\Component\System\Git;
 3: 
 4: use Contrib\Component\System\SystemCommand;
 5: 
 6: /**
 7:  * Git command.
 8:  *
 9:  * @author Kitamura Satoshi <with.no.parachute@gmail.com>
10:  */
11: class GitCommand extends SystemCommand
12: {
13:     /**
14:      * Command name or path.
15:      *
16:      * @var string
17:      */
18:     protected $commandPath = 'git';
19: 
20:     // API
21: 
22:     /**
23:      * Return branch names.
24:      *
25:      * @return array
26:      */
27:     public function getBranches()
28:     {
29:         $command = $this->createCommand('branch');
30: 
31:         return $this->executeCommand($command);
32:     }
33: 
34:     /**
35:      * Return HEAD commit.
36:      *
37:      * @return array
38:      */
39:     public function getHeadCommit()
40:     {
41:         $command = $this->createCommand("log -1 --pretty=format:'%H\n%aN\n%ae\n%cN\n%ce\n%s'");
42: 
43:         return $this->executeCommand($command);
44:     }
45: 
46:     /**
47:      * Return remote repositories.
48:      *
49:      * @return array
50:      */
51:     public function getRemotes()
52:     {
53:         $command = $this->createCommand('remote -v');
54: 
55:         return $this->executeCommand($command);
56:     }
57: }
58: 
php-coveralls API documentation generated by ApiGen 2.8.0