Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / diffusion / data / DiffusionRepositoryRef.php
blobde3451b25f8a2fb5cce1ff43fb05cc22ac5bcc62
1 <?php
3 /**
4 * @task serialization Serializing Repository Refs
5 */
6 final class DiffusionRepositoryRef extends Phobject {
8 private $shortName;
9 private $commitIdentifier;
10 private $refType;
11 private $rawFields = array();
13 public function setRawFields(array $raw_fields) {
14 $this->rawFields = $raw_fields;
15 return $this;
18 public function getRawFields() {
19 return $this->rawFields;
22 public function setCommitIdentifier($commit_identifier) {
23 $this->commitIdentifier = $commit_identifier;
24 return $this;
27 public function getCommitIdentifier() {
28 return $this->commitIdentifier;
31 public function setShortName($short_name) {
32 $this->shortName = $short_name;
33 return $this;
36 public function getShortName() {
37 return $this->shortName;
40 public function setRefType($ref_type) {
41 $this->refType = $ref_type;
42 return $this;
45 public function getRefType() {
46 return $this->refType;
49 public function isBranch() {
50 $type_branch = PhabricatorRepositoryRefCursor::TYPE_BRANCH;
51 return ($this->getRefType() === $type_branch);
54 public function isTag() {
55 $type_tag = PhabricatorRepositoryRefCursor::TYPE_TAG;
56 return ($this->getRefType() === $type_tag);
60 /* -( Serialization )------------------------------------------------------ */
63 public function toDictionary() {
64 return array(
65 'shortName' => $this->shortName,
66 'commitIdentifier' => $this->commitIdentifier,
67 'refType' => $this->refType,
68 'rawFields' => $this->rawFields,
72 public static function newFromDictionary(array $dict) {
73 return id(new DiffusionRepositoryRef())
74 ->setShortName($dict['shortName'])
75 ->setCommitIdentifier($dict['commitIdentifier'])
76 ->setRefType($dict['refType'])
77 ->setRawFields($dict['rawFields']);
80 public static function loadAllFromDictionaries(array $dictionaries) {
81 $refs = array();
82 foreach ($dictionaries as $dictionary) {
83 $refs[] = self::newFromDictionary($dictionary);
85 return $refs;