@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
at upstream/main 91 lines 1.8 kB view raw
1<?php 2 3final class PhabricatorStoragePatch extends Phobject { 4 5 private $key; 6 private $fullKey; 7 private $name; 8 private $type; 9 private $after; 10 private $legacy; 11 private $dead; 12 private $phase; 13 14 const PHASE_DEFAULT = 'default'; 15 const PHASE_WORKER = 'worker'; 16 17 public function __construct(array $dict) { 18 $this->key = $dict['key']; 19 $this->type = $dict['type']; 20 $this->fullKey = $dict['fullKey']; 21 $this->legacy = $dict['legacy']; 22 $this->name = $dict['name']; 23 $this->after = $dict['after']; 24 $this->dead = $dict['dead']; 25 $this->phase = $dict['phase']; 26 } 27 28 public function getLegacy() { 29 return $this->legacy; 30 } 31 32 public function getAfter() { 33 return $this->after; 34 } 35 36 public function getType() { 37 return $this->type; 38 } 39 40 public function getName() { 41 return $this->name; 42 } 43 44 public function getFullKey() { 45 return $this->fullKey; 46 } 47 48 public function getKey() { 49 return $this->key; 50 } 51 52 public function getPhase() { 53 return $this->phase; 54 } 55 56 public function isDead() { 57 return $this->dead; 58 } 59 60 public function getIsGlobalPatch() { 61 return ($this->getType() == 'php'); 62 } 63 64 public static function getPhaseList() { 65 return array_keys(self::getPhaseMap()); 66 } 67 68 public static function getDefaultPhase() { 69 return self::PHASE_DEFAULT; 70 } 71 72 private static function getPhaseMap() { 73 return array( 74 self::PHASE_DEFAULT => array( 75 'order' => 0, 76 ), 77 self::PHASE_WORKER => array( 78 'order' => 1, 79 ), 80 ); 81 } 82 83 public function newSortVector() { 84 $map = self::getPhaseMap(); 85 $phase = $this->getPhase(); 86 87 return id(new PhutilSortVector()) 88 ->addInt($map[$phase]['order']); 89 } 90 91}