1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Make webpage response final

This commit is contained in:
Elvan Hidayat 2012-11-29 14:57:13 +07:00 committed by epriestley
parent b4473d5998
commit 9c76964aa7
5 changed files with 24 additions and 16 deletions

View file

@ -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',

View file

@ -3,7 +3,7 @@
/**
* @group aphront
*/
final class Aphront403Response extends AphrontWebpageResponse {
final class Aphront403Response extends AphrontHTMLResponse {
private $forbiddenText;
public function setForbiddenText($text) {

View file

@ -3,7 +3,7 @@
/**
* @group aphront
*/
final class Aphront404Response extends AphrontWebpageResponse {
final class Aphront404Response extends AphrontHTMLResponse {
public function getHTTPResponseCode() {
return 404;

View 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;
}
}

View file

@ -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;
}
}