@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 46 lines 1.0 kB view raw
1<?php 2 3/** 4 * Resolve a list of identifiers into PHIDs. 5 * 6 * This class simplifies the process of converting a list of mixed token types 7 * (like some PHIDs and some usernames) into a list of just PHIDs. 8 */ 9abstract class PhabricatorPHIDResolver extends Phobject { 10 11 private $viewer; 12 13 final public function setViewer(PhabricatorUser $viewer) { 14 $this->viewer = $viewer; 15 return $this; 16 } 17 18 final public function getViewer() { 19 return $this->viewer; 20 } 21 22 final public function resolvePHIDs(array $phids) { 23 $type_unknown = PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN; 24 25 $names = array(); 26 foreach ($phids as $key => $phid) { 27 if (phid_get_type($phid) == $type_unknown) { 28 $names[$key] = $phid; 29 } 30 } 31 32 if ($names) { 33 $map = $this->getResolutionMap($names); 34 foreach ($names as $key => $name) { 35 if (isset($map[$name])) { 36 $phids[$key] = $map[$name]; 37 } 38 } 39 } 40 41 return $phids; 42 } 43 44 abstract protected function getResolutionMap(array $names); 45 46}