@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 PhabricatorAuthFactorResult
4 extends Phobject {
5
6 private $answeredChallenge;
7 private $isWait = false;
8 private $isError = false;
9 private $isContinue = false;
10 private $errorMessage;
11 private $value;
12 private $issuedChallenges = array();
13 private $icon;
14 private $statusChallenge;
15
16 public function setAnsweredChallenge(PhabricatorAuthChallenge $challenge) {
17 if (!$challenge->getIsAnsweredChallenge()) {
18 throw new PhutilInvalidStateException('markChallengeAsAnswered');
19 }
20
21 if ($challenge->getIsCompleted()) {
22 throw new Exception(
23 pht(
24 'A completed challenge was provided as an answered challenge. '.
25 'The underlying factor is implemented improperly, challenges '.
26 'may not be reused.'));
27 }
28
29 $this->answeredChallenge = $challenge;
30
31 return $this;
32 }
33
34 public function getAnsweredChallenge() {
35 return $this->answeredChallenge;
36 }
37
38 public function setStatusChallenge(PhabricatorAuthChallenge $challenge) {
39 $this->statusChallenge = $challenge;
40 return $this;
41 }
42
43 public function getStatusChallenge() {
44 return $this->statusChallenge;
45 }
46
47 public function getIsValid() {
48 return (bool)$this->getAnsweredChallenge();
49 }
50
51 public function setIsWait($is_wait) {
52 $this->isWait = $is_wait;
53 return $this;
54 }
55
56 public function getIsWait() {
57 return $this->isWait;
58 }
59
60 public function setIsError($is_error) {
61 $this->isError = $is_error;
62 return $this;
63 }
64
65 public function getIsError() {
66 return $this->isError;
67 }
68
69 public function setIsContinue($is_continue) {
70 $this->isContinue = $is_continue;
71 return $this;
72 }
73
74 public function getIsContinue() {
75 return $this->isContinue;
76 }
77
78 public function setErrorMessage($error_message) {
79 $this->errorMessage = $error_message;
80 return $this;
81 }
82
83 public function getErrorMessage() {
84 return $this->errorMessage;
85 }
86
87 public function setValue($value) {
88 $this->value = $value;
89 return $this;
90 }
91
92 public function getValue() {
93 return $this->value;
94 }
95
96 public function setIcon(PHUIIconView $icon) {
97 $this->icon = $icon;
98 return $this;
99 }
100
101 public function getIcon() {
102 return $this->icon;
103 }
104
105}