[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DoorkeeperObjectRef extends Phobject { 4 5 private $objectKey; 6 private $applicationType; 7 private $applicationDomain; 8 private $objectType; 9 private $objectID; 10 private $attributes = array(); 11 private $isVisible; 12 private $syncFailed; 13 private $externalObject; 14 15 public function newExternalObject() { 16 return id(new DoorkeeperExternalObject()) 17 ->setApplicationType($this->getApplicationType()) 18 ->setApplicationDomain($this->getApplicationDomain()) 19 ->setObjectType($this->getObjectType()) 20 ->setObjectID($this->getObjectID()) 21 ->setViewPolicy(PhabricatorPolicies::POLICY_USER); 22 } 23 24 public function attachExternalObject( 25 DoorkeeperExternalObject $external_object) { 26 $this->externalObject = $external_object; 27 return $this; 28 } 29 30 public function getExternalObject() { 31 if (!$this->externalObject) { 32 throw new Exception( 33 'Call attachExternalObject() before getExternalObject()!'); 34 } 35 return $this->externalObject; 36 } 37 38 public function setIsVisible($is_visible) { 39 $this->isVisible = $is_visible; 40 return $this; 41 } 42 43 public function getIsVisible() { 44 return $this->isVisible; 45 } 46 47 public function setSyncFailed($sync_failed) { 48 $this->syncFailed = $sync_failed; 49 return $this; 50 } 51 52 public function getSyncFailed() { 53 return $this->syncFailed; 54 } 55 56 public function getAttribute($key, $default = null) { 57 return idx($this->attributes, $key, $default); 58 } 59 60 public function setAttribute($key, $value) { 61 $this->attributes[$key] = $value; 62 return $this; 63 } 64 65 public function setObjectID($object_id) { 66 $this->objectID = $object_id; 67 return $this; 68 } 69 70 public function getObjectID() { 71 return $this->objectID; 72 } 73 74 75 public function setObjectType($object_type) { 76 $this->objectType = $object_type; 77 return $this; 78 } 79 80 public function getObjectType() { 81 return $this->objectType; 82 } 83 84 85 public function setApplicationDomain($application_domain) { 86 $this->applicationDomain = $application_domain; 87 return $this; 88 } 89 90 public function getApplicationDomain() { 91 return $this->applicationDomain; 92 } 93 94 95 public function setApplicationType($application_type) { 96 $this->applicationType = $application_type; 97 return $this; 98 } 99 100 public function getApplicationType() { 101 return $this->applicationType; 102 } 103 104 public function getFullName() { 105 return coalesce( 106 $this->getAttribute('fullname'), 107 $this->getAttribute('name'), 108 pht('External Object')); 109 } 110 111 public function getObjectKey() { 112 if (!$this->objectKey) { 113 $this->objectKey = PhabricatorHash::digestForIndex( 114 implode( 115 ':', 116 array( 117 $this->getApplicationType(), 118 $this->getApplicationDomain(), 119 $this->getObjectType(), 120 $this->getObjectID(), 121 ))); 122 } 123 return $this->objectKey; 124 } 125 126 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |