@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
3abstract class PhabricatorInlineCommentContentState
4 extends Phobject {
5
6 private $contentText = '';
7
8 public function setContentText($content_text) {
9 $this->contentText = $content_text;
10 return $this;
11 }
12
13 public function getContentText() {
14 return $this->contentText;
15 }
16
17 public function isEmptyContentState() {
18 return !strlen($this->getContentText());
19 }
20
21 public function writeStorageMap() {
22 return array(
23 'text' => $this->getContentText(),
24 );
25 }
26
27 public function readStorageMap(array $map) {
28 $text = (string)idx($map, 'text');
29 $this->setContentText($text);
30
31 return $this;
32 }
33
34 final public function readFromRequest(AphrontRequest $request) {
35 $map = $this->newStorageMapFromRequest($request);
36 return $this->readStorageMap($map);
37 }
38
39 protected function newStorageMapFromRequest(AphrontRequest $request) {
40 $map = array();
41
42 $map['text'] = (string)$request->getStr('text');
43
44 return $map;
45 }
46
47}