@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
3/**
4 * Isolated HTTP sink for testing.
5 */
6final class AphrontIsolatedHTTPSink extends AphrontHTTPSink {
7
8 private $status;
9 private $headers;
10 private $data;
11
12 protected function emitHTTPStatus($code, $message = '') {
13 $this->status = $code;
14 }
15
16 protected function emitHeader($name, $value) {
17 $this->headers[] = array($name, $value);
18 }
19
20 protected function emitData($data) {
21 $this->data .= $data;
22 }
23
24 protected function isWritable() {
25 return true;
26 }
27
28 public function getEmittedHTTPStatus() {
29 return $this->status;
30 }
31
32 public function getEmittedHeaders() {
33 return $this->headers;
34 }
35
36 public function getEmittedData() {
37 return $this->data;
38 }
39
40}