Path: blob/master/src/applications/herald/storage/transcript/HeraldRuleTranscript.php
12261 views
<?php12final class HeraldRuleTranscript extends Phobject {34protected $ruleID;5protected $ruleResultMap;6protected $ruleName;7protected $ruleOwner;89// See T13586. This no longer has readers, but was written by older versions10// of Herald. It contained a human readable English-language description of11// the outcome of rule evaluation and was superseded by "HeraldRuleResult".12protected $reason;1314// See T13586. Older transcripts store a boolean "true", a boolean "false",15// or the string "forbidden" here.16protected $result;1718public function setRuleID($rule_id) {19$this->ruleID = $rule_id;20return $this;21}2223public function getRuleID() {24return $this->ruleID;25}2627public function setRuleName($rule_name) {28$this->ruleName = $rule_name;29return $this;30}3132public function getRuleName() {33return $this->ruleName;34}3536public function setRuleOwner($rule_owner) {37$this->ruleOwner = $rule_owner;38return $this;39}4041public function getRuleOwner() {42return $this->ruleOwner;43}4445public function setRuleResult(HeraldRuleResult $result) {46$this->ruleResultMap = $result->newResultMap();47return $this;48}4950public function getRuleResult() {51$map = $this->ruleResultMap;5253if (is_array($map)) {54$result = HeraldRuleResult::newFromResultMap($map);55} else {56$legacy_result = $this->result;5758$result_data = array();5960if ($legacy_result === 'forbidden') {61$result_code = HeraldRuleResult::RESULT_OBJECT_STATE;62$result_data = array(63'reason' => $this->reason,64);65} else if ($legacy_result === true) {66$result_code = HeraldRuleResult::RESULT_ANY_MATCHED;67} else if ($legacy_result === false) {68$result_code = HeraldRuleResult::RESULT_ANY_FAILED;69} else {70$result_code = HeraldRuleResult::RESULT_UNKNOWN;71}7273$result = HeraldRuleResult::newFromResultCode($result_code)74->setResultData($result_data);75}7677return $result;78}7980}818283