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

  • Commit
  • Git
  • Remote
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
  1: <?php
  2: namespace Contrib\Bundle\CoverallsV1Bundle\Entity\Git;
  3: 
  4: use Contrib\Bundle\CoverallsV1Bundle\Entity\Coveralls;
  5: 
  6: /**
  7:  * Data represents "git" of Coveralls API.
  8:  *
  9:  * "git": {
 10:  *   "head": {
 11:  *     "id": "b31f08d07ae564b08237e5a336e478b24ccc4a65",
 12:  *     "author_name": "Nick Merwin",
 13:  *     "author_email": "...",
 14:  *     "committer_name": "Nick Merwin",
 15:  *     "committer_email": "...",
 16:  *     "message": "version bump"
 17:  *   },
 18:  *   "branch": "master",
 19:  *   "remotes": [
 20:  *     {
 21:  *       "name": "origin",
 22:  *       "url": "git@github.com:lemurheavy/coveralls-ruby.git"
 23:  *     }
 24:  *   ]
 25:  * }
 26:  *
 27:  * @author Kitamura Satoshi <with.no.parachute@gmail.com>
 28:  */
 29: class Git extends Coveralls
 30: {
 31:     /**
 32:      * Branch name.
 33:      *
 34:      * @var string
 35:      */
 36:     protected $branch;
 37: 
 38:     /**
 39:      * Head.
 40:      *
 41:      * @var Commit
 42:      */
 43:     protected $head;
 44: 
 45:     /**
 46:      * Remote.
 47:      *
 48:      * @var Remote[]
 49:      */
 50:     protected $remotes;
 51: 
 52:     /**
 53:      * Constructor.
 54:      *
 55:      * @param string $branch  Branch name.
 56:      * @param Commit $head    HEAD commit.
 57:      * @param array  $remotes Remote repositories.
 58:      */
 59:     public function __construct($branch, Commit $head, array $remotes)
 60:     {
 61:         $this->branch  = $branch;
 62:         $this->head    = $head;
 63:         $this->remotes = $remotes;
 64:     }
 65: 
 66:     // API
 67: 
 68:     /**
 69:      * {@inheritdoc}
 70:      *
 71:      * @see \Contrib\Bundle\CoverallsBundle\Entity\ArrayConvertable::toArray()
 72:      */
 73:     public function toArray()
 74:     {
 75:         $remotes = array();
 76: 
 77:         foreach ($this->remotes as $remote) {
 78:             $remotes[] = $remote->toArray();
 79:         }
 80: 
 81:         return array(
 82:             'branch'  => $this->branch,
 83:             'head'    => $this->head->toArray(),
 84:             'remotes' => $remotes,
 85:         );
 86:     }
 87: 
 88:     // accessor
 89: 
 90:     /**
 91:      * Return branch name.
 92:      *
 93:      * @return string
 94:      */
 95:     public function getBranch()
 96:     {
 97:         return $this->branch;
 98:     }
 99: 
100:     /**
101:      * Return HEAD commit.
102:      *
103:      * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Commit
104:      */
105:     public function getHead()
106:     {
107:         return $this->head;
108:     }
109: 
110:     /**
111:      * Return remote repositories.
112:      *
113:      * @return \Contrib\Bundle\CoverallsV1Bundle\Entity\Git\Remote[]
114:      */
115:     public function getRemotes()
116:     {
117:         return $this->remotes;
118:     }
119: }
120: 
php-coveralls API documentation generated by ApiGen 2.8.0