Path: blob/master/src/applications/doorkeeper/engine/DoorkeeperFeedStoryPublisher.php
12256 views
<?php12/**3* @task config Configuration4*/5abstract class DoorkeeperFeedStoryPublisher extends Phobject {67private $feedStory;8private $viewer;9private $renderWithImpliedContext;101112/* -( Configuration )------------------------------------------------------ */131415/**16* Render story text using contextual language to identify the object the17* story is about, instead of the full object name. For example, without18* contextual language a story might render like this:19*20* alincoln created D123: Chop Wood for Log Cabin v2.021*22* With contextual language, it will render like this instead:23*24* alincoln created this revision.25*26* If the interface where the text will be displayed is specific to an27* individual object (like Asana tasks that represent one review or commit28* are), it's generally more natural to use language that assumes context.29* If the target context may show information about several objects (like30* JIRA issues which can have several linked revisions), it's generally31* more useful not to assume context.32*33* @param bool True to assume object context when rendering.34* @return this35* @task config36*/37public function setRenderWithImpliedContext($render_with_implied_context) {38$this->renderWithImpliedContext = $render_with_implied_context;39return $this;40}4142/**43* Determine if rendering should assume object context. For discussion, see44* @{method:setRenderWithImpliedContext}.45*46* @return bool True if rendering should assume object context is implied.47* @task config48*/49public function getRenderWithImpliedContext() {50return $this->renderWithImpliedContext;51}5253public function setFeedStory(PhabricatorFeedStory $feed_story) {54$this->feedStory = $feed_story;55return $this;56}5758public function getFeedStory() {59return $this->feedStory;60}6162public function setViewer(PhabricatorUser $viewer) {63$this->viewer = $viewer;64return $this;65}6667public function getViewer() {68return $this->viewer;69}7071abstract public function canPublishStory(72PhabricatorFeedStory $story,73$object);7475/**76* Hook for publishers to mutate the story object, particularly by loading77* and attaching additional data.78*/79public function willPublishStory($object) {80return $object;81}828384public function getStoryText($object) {85return $this->getFeedStory()->renderAsTextForDoorkeeper($this);86}8788abstract public function isStoryAboutObjectCreation($object);89abstract public function isStoryAboutObjectClosure($object);90abstract public function getOwnerPHID($object);91abstract public function getActiveUserPHIDs($object);92abstract public function getPassiveUserPHIDs($object);93abstract public function getCCUserPHIDs($object);94abstract public function getObjectTitle($object);95abstract public function getObjectURI($object);96abstract public function getObjectDescription($object);97abstract public function isObjectClosed($object);98abstract public function getResponsibilityTitle($object);99100}101102103