[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/data/ -> DiffusionCommitRef.php (source)

   1  <?php
   2  
   3  final class DiffusionCommitRef extends Phobject {
   4  
   5    private $message;
   6    private $authorName;
   7    private $authorEmail;
   8    private $committerName;
   9    private $committerEmail;
  10    private $hashes = array();
  11  
  12    public function setHashes(array $hashes) {
  13      $this->hashes = $hashes;
  14      return $this;
  15    }
  16  
  17    public function getHashes() {
  18      return $this->hashes;
  19    }
  20  
  21    public function setCommitterEmail($committer_email) {
  22      $this->committerEmail = $committer_email;
  23      return $this;
  24    }
  25  
  26    public function getCommitterEmail() {
  27      return $this->committerEmail;
  28    }
  29  
  30  
  31    public function setCommitterName($committer_name) {
  32      $this->committerName = $committer_name;
  33      return $this;
  34    }
  35  
  36    public function getCommitterName() {
  37      return $this->committerName;
  38    }
  39  
  40  
  41    public function setAuthorEmail($author_email) {
  42      $this->authorEmail = $author_email;
  43      return $this;
  44    }
  45  
  46    public function getAuthorEmail() {
  47      return $this->authorEmail;
  48    }
  49  
  50  
  51    public function setAuthorName($author_name) {
  52      $this->authorName = $author_name;
  53      return $this;
  54    }
  55  
  56    public function getAuthorName() {
  57      return $this->authorName;
  58    }
  59  
  60    public function setMessage($message) {
  61      $this->message = $message;
  62      return $this;
  63    }
  64  
  65    public function getMessage() {
  66      return $this->message;
  67    }
  68  
  69    public function getAuthor() {
  70      return $this->formatUser($this->authorName, $this->authorEmail);
  71    }
  72  
  73    public function getCommitter() {
  74      return $this->formatUser($this->committerName, $this->committerEmail);
  75    }
  76  
  77    public function getSummary() {
  78      return PhabricatorRepositoryCommitData::summarizeCommitMessage(
  79        $this->getMessage());
  80    }
  81  
  82    private function formatUser($name, $email) {
  83      if (strlen($name) && strlen($email)) {
  84        return "{$name} <{$email}>";
  85      } else if (strlen($email)) {
  86        return $email;
  87      } else if (strlen($name)) {
  88        return $name;
  89      } else {
  90        return null;
  91      }
  92    }
  93  
  94  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1