Path: blob/master/src/applications/diffusion/data/DiffusionRepositoryRef.php
12241 views
<?php12/**3* @task serialization Serializing Repository Refs4*/5final class DiffusionRepositoryRef extends Phobject {67private $shortName;8private $commitIdentifier;9private $refType;10private $rawFields = array();1112public function setRawFields(array $raw_fields) {13$this->rawFields = $raw_fields;14return $this;15}1617public function getRawFields() {18return $this->rawFields;19}2021public function setCommitIdentifier($commit_identifier) {22$this->commitIdentifier = $commit_identifier;23return $this;24}2526public function getCommitIdentifier() {27return $this->commitIdentifier;28}2930public function setShortName($short_name) {31$this->shortName = $short_name;32return $this;33}3435public function getShortName() {36return $this->shortName;37}3839public function setRefType($ref_type) {40$this->refType = $ref_type;41return $this;42}4344public function getRefType() {45return $this->refType;46}4748public function isBranch() {49$type_branch = PhabricatorRepositoryRefCursor::TYPE_BRANCH;50return ($this->getRefType() === $type_branch);51}5253public function isTag() {54$type_tag = PhabricatorRepositoryRefCursor::TYPE_TAG;55return ($this->getRefType() === $type_tag);56}575859/* -( Serialization )------------------------------------------------------ */606162public function toDictionary() {63return array(64'shortName' => $this->shortName,65'commitIdentifier' => $this->commitIdentifier,66'refType' => $this->refType,67'rawFields' => $this->rawFields,68);69}7071public static function newFromDictionary(array $dict) {72return id(new DiffusionRepositoryRef())73->setShortName($dict['shortName'])74->setCommitIdentifier($dict['commitIdentifier'])75->setRefType($dict['refType'])76->setRawFields($dict['rawFields']);77}7879public static function loadAllFromDictionaries(array $dictionaries) {80$refs = array();81foreach ($dictionaries as $dictionary) {82$refs[] = self::newFromDictionary($dictionary);83}84return $refs;85}8687}888990