3 final class HeraldConditionTranscript
extends Phobject
{
6 protected $conditionID;
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"
17 // The modern record does not use either field.
22 public function setRuleID($rule_id) {
23 $this->ruleID
= $rule_id;
27 public function getRuleID() {
31 public function setConditionID($condition_id) {
32 $this->conditionID
= $condition_id;
36 public function getConditionID() {
37 return $this->conditionID
;
40 public function setFieldName($field_name) {
41 $this->fieldName
= $field_name;
45 public function getFieldName() {
46 return $this->fieldName
;
49 public function setCondition($condition) {
50 $this->condition
= $condition;
54 public function getCondition() {
55 return $this->condition
;
58 public function setTestValue($test_value) {
59 $this->testValue
= $test_value;
63 public function getTestValue() {
64 return $this->testValue
;
67 public function setResult(HeraldConditionResult
$result) {
68 $this->resultMap
= $result->newResultMap();
72 public function getResult() {
73 $map = $this->resultMap
;
76 $result = HeraldConditionResult
::newFromResultMap($map);
78 $legacy_result = $this->result
;
80 $result_data = array();
82 if ($legacy_result === 'forbidden') {
83 $result_code = HeraldConditionResult
::RESULT_OBJECT_STATE
;
85 'reason' => $this->note
,
87 } else if ($legacy_result === true) {
88 $result_code = HeraldConditionResult
::RESULT_MATCHED
;
89 } else if ($legacy_result === false) {
90 $result_code = HeraldConditionResult
::RESULT_FAILED
;
92 $result_code = HeraldConditionResult
::RESULT_UNKNOWN
;
95 $result = HeraldConditionResult
::newFromResultCode($result_code)
96 ->setResultData($result_data);