mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Make webpage response final
This commit is contained in:
parent
b4473d5998
commit
9c76964aa7
5 changed files with 24 additions and 16 deletions
|
@ -52,6 +52,7 @@ phutil_register_library_map(array(
|
|||
'AphrontFormToggleButtonsControl' => 'view/form/control/AphrontFormToggleButtonsControl.php',
|
||||
'AphrontFormTokenizerControl' => 'view/form/control/AphrontFormTokenizerControl.php',
|
||||
'AphrontFormView' => 'view/form/AphrontFormView.php',
|
||||
'AphrontHTMLResponse' => 'aphront/response/AphrontHTMLResponse.php',
|
||||
'AphrontHTTPSink' => 'aphront/sink/AphrontHTTPSink.php',
|
||||
'AphrontHTTPSinkTestCase' => 'aphront/sink/__tests__/AphrontHTTPSinkTestCase.php',
|
||||
'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php',
|
||||
|
@ -1317,8 +1318,8 @@ phutil_register_library_map(array(
|
|||
array(
|
||||
'Aphront304Response' => 'AphrontResponse',
|
||||
'Aphront400Response' => 'AphrontResponse',
|
||||
'Aphront403Response' => 'AphrontWebpageResponse',
|
||||
'Aphront404Response' => 'AphrontWebpageResponse',
|
||||
'Aphront403Response' => 'AphrontHTMLResponse',
|
||||
'Aphront404Response' => 'AphrontHTMLResponse',
|
||||
'AphrontAjaxResponse' => 'AphrontResponse',
|
||||
'AphrontAttachedFileView' => 'AphrontView',
|
||||
'AphrontCSRFException' => 'AphrontException',
|
||||
|
@ -1355,6 +1356,7 @@ phutil_register_library_map(array(
|
|||
'AphrontFormToggleButtonsControl' => 'AphrontFormControl',
|
||||
'AphrontFormTokenizerControl' => 'AphrontFormControl',
|
||||
'AphrontFormView' => 'AphrontView',
|
||||
'AphrontHTMLResponse' => 'AphrontResponse',
|
||||
'AphrontHTTPSinkTestCase' => 'PhabricatorTestCase',
|
||||
'AphrontHeadsupActionListView' => 'AphrontView',
|
||||
'AphrontHeadsupActionView' => 'AphrontView',
|
||||
|
@ -1386,7 +1388,7 @@ phutil_register_library_map(array(
|
|||
'AphrontTokenizerTemplateView' => 'AphrontView',
|
||||
'AphrontTypeaheadTemplateView' => 'AphrontView',
|
||||
'AphrontUsageException' => 'AphrontException',
|
||||
'AphrontWebpageResponse' => 'AphrontResponse',
|
||||
'AphrontWebpageResponse' => 'AphrontHTMLResponse',
|
||||
'CelerityPhabricatorResourceController' => 'CelerityResourceController',
|
||||
'CelerityResourceController' => 'PhabricatorController',
|
||||
'CelerityResourceGraph' => 'AbstractDirectedGraph',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* @group aphront
|
||||
*/
|
||||
final class Aphront403Response extends AphrontWebpageResponse {
|
||||
final class Aphront403Response extends AphrontHTMLResponse {
|
||||
|
||||
private $forbiddenText;
|
||||
public function setForbiddenText($text) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/**
|
||||
* @group aphront
|
||||
*/
|
||||
final class Aphront404Response extends AphrontWebpageResponse {
|
||||
final class Aphront404Response extends AphrontHTMLResponse {
|
||||
|
||||
public function getHTTPResponseCode() {
|
||||
return 404;
|
||||
|
|
16
src/aphront/response/AphrontHTMLResponse.php
Normal file
16
src/aphront/response/AphrontHTMLResponse.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @group aphront
|
||||
*/
|
||||
abstract class AphrontHTMLResponse extends AphrontResponse {
|
||||
|
||||
public function getHeaders() {
|
||||
$headers = array(
|
||||
array('Content-Type', 'text/html; charset=UTF-8'),
|
||||
);
|
||||
$headers = array_merge(parent::getHeaders(), $headers);
|
||||
return $headers;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* TODO: Should be final, but isn't because of Aphront403Response / 404Response.
|
||||
*
|
||||
* @group aphront
|
||||
*/
|
||||
class AphrontWebpageResponse extends AphrontResponse {
|
||||
final class AphrontWebpageResponse extends AphrontHTMLResponse {
|
||||
|
||||
private $content;
|
||||
|
||||
|
@ -18,12 +16,4 @@ class AphrontWebpageResponse extends AphrontResponse {
|
|||
return $this->content;
|
||||
}
|
||||
|
||||
public function getHeaders() {
|
||||
$headers = array(
|
||||
array('Content-Type', 'text/html; charset=UTF-8'),
|
||||
);
|
||||
$headers = array_merge(parent::getHeaders(), $headers);
|
||||
return $headers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue