Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/infrastructure/diff/inline/PhabricatorDiffInlineCommentContentState.php
12242 views
1
<?php
2
3
final class PhabricatorDiffInlineCommentContentState
4
extends PhabricatorInlineCommentContentState {
5
6
private $hasSuggestion = false;
7
private $suggestionText = '';
8
9
public function isEmptyContentState() {
10
if (!parent::isEmptyContentState()) {
11
return false;
12
}
13
14
if ($this->getContentHasSuggestion()) {
15
if (strlen($this->getContentSuggestionText())) {
16
return false;
17
}
18
}
19
20
return true;
21
}
22
23
public function setContentSuggestionText($suggestion_text) {
24
$this->suggestionText = $suggestion_text;
25
return $this;
26
}
27
28
public function getContentSuggestionText() {
29
return $this->suggestionText;
30
}
31
32
public function setContentHasSuggestion($has_suggestion) {
33
$this->hasSuggestion = $has_suggestion;
34
return $this;
35
}
36
37
public function getContentHasSuggestion() {
38
return $this->hasSuggestion;
39
}
40
41
public function newStorageMap() {
42
return parent::writeStorageMap() + array(
43
'hasSuggestion' => $this->getContentHasSuggestion(),
44
'suggestionText' => $this->getContentSuggestionText(),
45
);
46
}
47
48
public function readStorageMap(array $map) {
49
$result = parent::readStorageMap($map);
50
51
$has_suggestion = (bool)idx($map, 'hasSuggestion');
52
$this->setContentHasSuggestion($has_suggestion);
53
54
$suggestion_text = (string)idx($map, 'suggestionText');
55
$this->setContentSuggestionText($suggestion_text);
56
57
return $result;
58
}
59
60
protected function newStorageMapFromRequest(AphrontRequest $request) {
61
$map = parent::newStorageMapFromRequest($request);
62
63
$map['hasSuggestion'] = (bool)$request->getBool('hasSuggestion');
64
$map['suggestionText'] = (string)$request->getStr('suggestionText');
65
66
return $map;
67
}
68
69
}
70
71