@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 102 lines 2.4 kB view raw
1<?php 2 3final class HeraldConditionTranscript extends Phobject { 4 5 protected $ruleID; 6 protected $conditionID; 7 protected $fieldName; 8 protected $condition; 9 protected $testValue; 10 protected $resultMap; 11 12 // See T13586. Older versions of this record stored a boolean true, boolean 13 // false, or the string "forbidden" in the "$result" field. They stored a 14 // human-readable English-language message or a state code in the "$note" 15 // field. 16 17 // The modern record does not use either field. 18 19 protected $result; 20 protected $note; 21 22 public function setRuleID($rule_id) { 23 $this->ruleID = $rule_id; 24 return $this; 25 } 26 27 public function getRuleID() { 28 return $this->ruleID; 29 } 30 31 public function setConditionID($condition_id) { 32 $this->conditionID = $condition_id; 33 return $this; 34 } 35 36 public function getConditionID() { 37 return $this->conditionID; 38 } 39 40 public function setFieldName($field_name) { 41 $this->fieldName = $field_name; 42 return $this; 43 } 44 45 public function getFieldName() { 46 return $this->fieldName; 47 } 48 49 public function setCondition($condition) { 50 $this->condition = $condition; 51 return $this; 52 } 53 54 public function getCondition() { 55 return $this->condition; 56 } 57 58 public function setTestValue($test_value) { 59 $this->testValue = $test_value; 60 return $this; 61 } 62 63 public function getTestValue() { 64 return $this->testValue; 65 } 66 67 public function setResult(HeraldConditionResult $result) { 68 $this->resultMap = $result->newResultMap(); 69 return $this; 70 } 71 72 public function getResult() { 73 $map = $this->resultMap; 74 75 if (is_array($map)) { 76 $result = HeraldConditionResult::newFromResultMap($map); 77 } else { 78 $legacy_result = $this->result; 79 80 $result_data = array(); 81 82 if ($legacy_result === 'forbidden') { 83 $result_code = HeraldConditionResult::RESULT_OBJECT_STATE; 84 $result_data = array( 85 'reason' => $this->note, 86 ); 87 } else if ($legacy_result === true) { 88 $result_code = HeraldConditionResult::RESULT_MATCHED; 89 } else if ($legacy_result === false) { 90 $result_code = HeraldConditionResult::RESULT_FAILED; 91 } else { 92 $result_code = HeraldConditionResult::RESULT_UNKNOWN; 93 } 94 95 $result = HeraldConditionResult::newFromResultCode($result_code) 96 ->setResultData($result_data); 97 } 98 99 return $result; 100 } 101 102}