Path: blob/master/src/applications/doorkeeper/engine/DoorkeeperObjectRef.php
12256 views
<?php12final class DoorkeeperObjectRef extends Phobject {34private $objectKey;5private $applicationType;6private $applicationDomain;7private $objectType;8private $objectID;9private $attributes = array();10private $isVisible;11private $syncFailed;12private $externalObject;1314public function newExternalObject() {15return id(new DoorkeeperExternalObject())16->setApplicationType($this->getApplicationType())17->setApplicationDomain($this->getApplicationDomain())18->setObjectType($this->getObjectType())19->setObjectID($this->getObjectID())20->setViewPolicy(PhabricatorPolicies::POLICY_USER);21}2223public function attachExternalObject(24DoorkeeperExternalObject $external_object) {25$this->externalObject = $external_object;26return $this;27}2829public function getExternalObject() {30if (!$this->externalObject) {31throw new PhutilInvalidStateException('attachExternalObject');32}33return $this->externalObject;34}3536public function setIsVisible($is_visible) {37$this->isVisible = $is_visible;38return $this;39}4041public function getIsVisible() {42return $this->isVisible;43}4445public function setSyncFailed($sync_failed) {46$this->syncFailed = $sync_failed;47return $this;48}4950public function getSyncFailed() {51return $this->syncFailed;52}5354public function getAttribute($key, $default = null) {55return idx($this->attributes, $key, $default);56}5758public function setAttribute($key, $value) {59$this->attributes[$key] = $value;60return $this;61}6263public function setObjectID($object_id) {64$this->objectID = $object_id;65return $this;66}6768public function getObjectID() {69return $this->objectID;70}717273public function setObjectType($object_type) {74$this->objectType = $object_type;75return $this;76}7778public function getObjectType() {79return $this->objectType;80}818283public function setApplicationDomain($application_domain) {84$this->applicationDomain = $application_domain;85return $this;86}8788public function getApplicationDomain() {89return $this->applicationDomain;90}919293public function setApplicationType($application_type) {94$this->applicationType = $application_type;95return $this;96}9798public function getApplicationType() {99return $this->applicationType;100}101102public function getFullName() {103return coalesce(104$this->getAttribute('fullname'),105$this->getAttribute('name'),106pht('External Object'));107}108109public function getShortName() {110return coalesce(111$this->getAttribute('shortname'),112$this->getAttribute('name'),113pht('External Object'));114}115116public function getObjectKey() {117if (!$this->objectKey) {118$this->objectKey = PhabricatorHash::digestForIndex(119implode(120':',121array(122$this->getApplicationType(),123$this->getApplicationDomain(),124$this->getObjectType(),125$this->getObjectID(),126)));127}128return $this->objectKey;129}130131}132133134