Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/storage/PhabricatorFileAttachment.php
Show All 40 Lines | final class PhabricatorFileAttachment | ||||
public static function getModeList() { | public static function getModeList() { | ||||
return array( | return array( | ||||
self::MODE_ATTACH, | self::MODE_ATTACH, | ||||
self::MODE_REFERENCE, | self::MODE_REFERENCE, | ||||
self::MODE_DETACH, | self::MODE_DETACH, | ||||
); | ); | ||||
} | } | ||||
public static function getModeNameMap() { | |||||
return array( | |||||
self::MODE_ATTACH => pht('Attached'), | |||||
self::MODE_REFERENCE => pht('Referenced'), | |||||
); | |||||
} | |||||
public function isPolicyAttachment() { | public function isPolicyAttachment() { | ||||
switch ($this->getAttachmentMode()) { | switch ($this->getAttachmentMode()) { | ||||
case self::MODE_ATTACH: | case self::MODE_ATTACH: | ||||
return true; | return true; | ||||
default: | default: | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
Show All 11 Lines | public function attachFile(PhabricatorFile $file = null) { | ||||
$this->file = $file; | $this->file = $file; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getFile() { | public function getFile() { | ||||
return $this->assertAttached($this->file); | return $this->assertAttached($this->file); | ||||
} | } | ||||
public function canDetach() { | |||||
switch ($this->getAttachmentMode()) { | |||||
case self::MODE_ATTACH: | |||||
return true; | |||||
} | |||||
return false; | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
); | ); | ||||
Show All 24 Lines |