@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<?php
2
3final class PhabricatorGuidanceMessage
4 extends Phobject {
5
6 private $key;
7 private $message;
8 private $severity = self::SEVERITY_NOTICE;
9 private $priority = 1000;
10
11 const SEVERITY_NOTICE = 'notice';
12 const SEVERITY_WARNING = 'warning';
13
14 public function setSeverity($severity) {
15 $this->severity = $severity;
16 return $this;
17 }
18
19 public function getSeverity() {
20 return $this->severity;
21 }
22
23 public function setKey($key) {
24 $this->key = $key;
25 return $this;
26 }
27
28 public function getKey() {
29 return $this->key;
30 }
31
32 public function setMessage($message) {
33 $this->message = $message;
34 return $this;
35 }
36
37 public function getMessage() {
38 return $this->message;
39 }
40
41 public function getSortVector() {
42 return id(new PhutilSortVector())
43 ->addInt($this->getPriority());
44 }
45
46 public function setPriority($priority) {
47 $this->priority = $priority;
48 return $this;
49 }
50
51 public function getPriority() {
52 return $this->priority;
53 }
54
55 public function getSeverityStrength() {
56 $map = array(
57 self::SEVERITY_NOTICE => 1,
58 self::SEVERITY_WARNING => 2,
59 );
60
61 return idx($map, $this->getSeverity(), 0);
62 }
63
64
65}