本文整理汇总了PHP中TYPO3\Flow\Http\Response::getStatusMessageByCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getStatusMessageByCode方法的具体用法?PHP Response::getStatusMessageByCode怎么用?PHP Response::getStatusMessageByCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Http\Response
的用法示例。
在下文中一共展示了Response::getStatusMessageByCode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: echoExceptionWeb
/**
* Echoes an exception for the web.
*
* @param \Exception $exception The exception
* @return void
*/
protected function echoExceptionWeb(\Exception $exception)
{
if ($exception instanceof Exception) {
$statusCode = 400;
$json = ['status' => 'invalid_request', 'reason' => $exception->getMessage()];
} elseif ($exception instanceof \TYPO3\Flow\Security\Exception) {
$statusCode = 403;
$json = ['status' => 'unauthorized', 'reason' => $exception->getMessage()];
} else {
$statusCode = 500;
if ($exception instanceof FlowException) {
$statusCode = $exception->getStatusCode();
}
$json = ['status' => 'error', 'reason' => $exception->getMessage(), 'errorClass' => get_class($exception)];
}
if ($exception->getPrevious() !== NULL) {
$json['previous'] = $exception->getPrevious()->getMessage();
}
$json['stacktrace'] = explode("\n", $exception->getTraceAsString());
$statusMessage = Response::getStatusMessageByCode($statusCode);
if (!headers_sent()) {
header(sprintf('HTTP/1.1 %s %s', $statusCode, $statusMessage));
header('Content-Type: application/json');
}
print json_encode($json);
}
示例2: getStatusCode
/**
* @return integer
*/
public function getStatusCode()
{
$statusCode = $this->tsValue('statusCode');
if ($statusCode === null) {
$statusCode = 200;
}
if (Response::getStatusMessageByCode($statusCode) === 'Unknown Status') {
throw new \InvalidArgumentException('Unknown HTTP status code', 1412085703);
}
return (int) $statusCode;
}
示例3: echoExceptionWeb
/**
* Echoes an exception for the web.
*
* @param \Exception $exception The exception
* @return void
*/
protected function echoExceptionWeb(\Exception $exception)
{
if ($exception instanceof Exception) {
$statusCode = 400;
$json = ['status' => 'invalid_request'];
} elseif ($exception instanceof \TYPO3\Flow\Security\Exception) {
$statusCode = 403;
$json = ['status' => 'unauthorized'];
} else {
$statusCode = 500;
if ($exception instanceof FlowException) {
$statusCode = $exception->getStatusCode();
}
$json = ['status' => 'error'];
}
$statusMessage = Response::getStatusMessageByCode($statusCode);
if (!headers_sent()) {
header(sprintf('HTTP/1.1 %s %s', $statusCode, $statusMessage));
header('Content-Type: application/json');
}
print json_encode($json);
}
示例4: renderStatically
/**
* Returns the statically rendered exception message
*
* @param integer $statusCode
* @param string $referenceCode
* @return string
*/
protected function renderStatically($statusCode, $referenceCode)
{
$statusMessage = \TYPO3\Flow\Http\Response::getStatusMessageByCode($statusCode);
$referenceCodeMessage = $referenceCode !== NULL ? '<p>When contacting the maintainer of this application please mention the following reference code:<br /><br />' . $referenceCode . '</p>' : '';
return '<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>' . $statusCode . ' ' . $statusMessage . '</title>
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
margin: 0;
}
h1 {
font-size: 15px;
}
.ApplicationWindow {
position: absolute;
width: 100%;
height: 100%;
background-color: #515151;
margin: 0;
z-index:1000;
}
.FloatingWindow {
width: 500px;
height: 360px;
background-color: none;
background-image: url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAfkAAAFwCAYAAAC7CQL0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmC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G7rffKl0FeZf7P+4dIp/lq0TaLQ1+HFJf8qWLIH4HKFPtfLeOCND1yPD16Pl+1nPVN86fr1vaY9T75ZRXcd76oj8MuOyOeW6uPAm+QBuOyTfJtEPveeL/PMRB/vh8+dPrfxW81OB/x1sn6yoWeCj0+1Syf4UuBrkzwAV2iSH/KeL+nSfd8lbTc6sr4U+bYwyVdR7EPHD7R+8uu4dy3TlyZ5ALhMoW8yg29u2T4X+zTs6QVwmuQxNl6ub6PQru+g6Zny02WJdHm+a4IvTfFiD8BFj3vfNN/1du2LJPq595NvQv7I+vQ5jJrkQ+ZOmo5JP/4hJqsnm4Z9aOCdQgfARQ97afAdEvo0+HHUl4W4b3TQXVfk08DXUejXD1AXIr8I+WX5oYEXdQAu8zSfC31uGX9I2NPbUUr75Kvktok+rjM/RB1+O82uHhD23NH0lekdgEs41behfLR9V/BzWy7sZ86NPzg4aI+Pjzee5HOhX2uS7zVJuEu31cDpXeABuIyhL031bSHepZjnthcCv80knwt9+rV0Ao9j3xXyXNgFHoCrFvpQiPSQLbc6EMYGvi/ycdRLP0gu2F1fK8Vd4AG4CqHPxb4U7dLXsvc7NvBDIp8+SGmybwuxHhJycQfgKsa+6w+Avu9tHPaxke99AsfHx1XPDynoAAh/wbYxL0a3bVsvAQBcQbVfAQCIPAAg8gCAyAMAIg8AiDwAiLxfAQCIPAAg8gDAy/bfAQDpDpA3DxeAjAAAAABJRU5ErkJggg==);
}
.FloatingWindow .Window_TitleBar {
font-size: 13px;
position: relative;
padding: 25px 0 0 26px;
width: 440px;
text-align: center;
color: #404040;
}
.FloatingWindow .Window_Body {
font-size: 14px;
position: relative;
padding: 30px 0 0 50px;
width: 400px;
text-align: left;
color: #202020;
line-height: 18px;
}
.StandardView_Package {
width: 70px;
float: right;
margin: 0 0 80px 10px;
}
</style>
<!--[if lte IE 7]>
<style type="text/css">
.FloatingWindow {
background-color: #ccc;
background-image: none;
}
.Window_TitleBar {
background-color:#aaa;
font-weight:bold;
}
.StandardView_Package {
display:none;
}
</style>
<![endif]-->
</head>
<body>
<div class="ApplicationWindow">
<div class="FloatingWindow">
<div class="Window_TitleBar">' . $statusCode . ' ' . $statusMessage . '</div>
<div class="Window_Body">
<h1>' . $statusCode . ' ' . $statusMessage . '</h1>
<p>An internal error occurred.</p>
' . $referenceCodeMessage . '
</div>
</div>
</div>
</body>
</html>';
}
示例5: renderStatically
/**
* Returns the statically rendered exception message
*
* @param integer $statusCode
* @param \Exception $exception
* @return void
*/
protected function renderStatically($statusCode, \Exception $exception)
{
$statusMessage = Response::getStatusMessageByCode($statusCode);
$exceptionHeader = '';
while (true) {
$pathPosition = strpos($exception->getFile(), 'Packages/');
$filePathAndName = $pathPosition !== false ? substr($exception->getFile(), $pathPosition) : $exception->getFile();
$exceptionCodeNumber = $exception->getCode() > 0 ? '#' . $exception->getCode() . ': ' : '';
$moreInformationLink = $exceptionCodeNumber != '' ? '<p><a href="http://typo3.org/go/exception/' . $exception->getCode() . '">More information</a></p>' : '';
$exceptionMessageParts = $this->splitExceptionMessage($exception->getMessage());
$exceptionHeader .= '<h2 class="ExceptionSubject">' . $exceptionCodeNumber . htmlspecialchars($exceptionMessageParts['subject']) . '</h2>';
if ($exceptionMessageParts['body'] !== '') {
$exceptionHeader .= '<p class="ExceptionBody">' . nl2br(htmlspecialchars($exceptionMessageParts['body'])) . '</p>';
}
$exceptionHeader .= $moreInformationLink . '
<span class="ExceptionProperty">' . get_class($exception) . '</span> thrown in file<br />
<span class="ExceptionProperty">' . $filePathAndName . '</span> in line
<span class="ExceptionProperty">' . $exception->getLine() . '</span>.<br />';
if ($exception instanceof FlowException) {
$exceptionHeader .= '<span class="ExceptionProperty">Reference code: ' . $exception->getReferenceCode() . '</span><br />';
}
if ($exception->getPrevious() === null) {
break;
}
$exceptionHeader .= '<br /><div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Nested Exception</div>';
$exception = $exception->getPrevious();
}
$backtraceCode = Debugger::getBacktraceCode($exception->getTrace());
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<title>' . $statusCode . ' ' . $statusMessage . '</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.ExceptionSubject {
margin: 0;
padding: 0;
font-size: 15px;
color: #BE0027;
}
.ExceptionBody {
padding: 10px;
margin: 10px;
color: black;
background: #DDD;
}
.ExceptionProperty {
color: #101010;
}
pre {
margin: 0;
font-size: 11px;
color: #515151;
background-color: #D0D0D0;
padding-left: 30px;
}
</style>
</head>
<div style="
position: absolute;
left: 10px;
background-color: #B9B9B9;
outline: 1px solid #515151;
color: #515151;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 10px;
padding: 0;
">
<div style="width: 100%; background-color: #515151; color: white; padding: 2px; margin: 0 0 6px 0;">Uncaught Exception in Flow</div>
<div style="width: 100%; padding: 2px; margin: 0 0 6px 0;">
' . $exceptionHeader . '
<br />
' . $backtraceCode . '
</div>
</div>
';
}
示例6: buildCustomFluidView
/**
* Prepares a Fluid view for rendering the custom error page.
*
* @param \Exception $exception
* @param array $renderingOptions Rendering options as defined in the settings
* @return StandaloneView
*/
protected function buildCustomFluidView(\Exception $exception, array $renderingOptions)
{
$statusCode = 500;
$referenceCode = NULL;
if ($exception instanceof FlowException) {
$statusCode = $exception->getStatusCode();
$referenceCode = $exception->getReferenceCode();
}
$statusMessage = Response::getStatusMessageByCode($statusCode);
$fluidView = new StandaloneView();
$fluidView->getRequest()->setControllerPackageKey('TYPO3.Flow');
$fluidView->setTemplatePathAndFilename($renderingOptions['templatePathAndFilename']);
if (isset($renderingOptions['layoutRootPath'])) {
$fluidView->setLayoutRootPath($renderingOptions['layoutRootPath']);
}
if (isset($renderingOptions['partialRootPath'])) {
$fluidView->setPartialRootPath($renderingOptions['partialRootPath']);
}
if (isset($renderingOptions['format'])) {
$fluidView->setFormat($renderingOptions['format']);
}
if (isset($renderingOptions['variables'])) {
$fluidView->assignMultiple($renderingOptions['variables']);
}
$fluidView->assignMultiple(array('exception' => $exception, 'renderingOptions' => $renderingOptions, 'statusCode' => $statusCode, 'statusMessage' => $statusMessage, 'referenceCode' => $referenceCode));
return $fluidView;
}
示例7: logException
/**
* @param \Exception $exception
* @return void
*/
public function logException(\Exception $exception)
{
if (!isset($this->settings['host']) || strlen($this->settings['host']) === 0) {
return;
}
$statusCode = NULL;
if ($exception instanceof FlowException) {
$statusCode = $exception->getStatusCode();
}
// skip exceptions with status codes matching "skipStatusCodes" setting
if (isset($this->settings['skipStatusCodes']) && in_array($statusCode, $this->settings['skipStatusCodes'])) {
return;
}
$host = $this->settings['host'];
$port = isset($this->settings['port']) ? $this->settings['port'] : UdpTransport::DEFAULT_PORT;
// set chunk size option to wan (default) or lan
if (isset($this->settings['chunksize']) && strtolower($this->settings['chunksize']) === 'lan') {
$chunkSize = UdpTransport::CHUNK_SIZE_LAN;
} else {
$chunkSize = UdpTransport::CHUNK_SIZE_WAN;
}
// setup connection to graylog server
$transport = new UdpTransport($host, $port, $chunkSize);
$publisher = new Publisher();
$publisher->addTransport($transport);
// set logLevel depending on http status code
$logLevel = 4;
// warning
if ($statusCode === 500) {
$logLevel = 3;
// error
}
// build message context
$messageContext = array('full_message' => $exception->getTraceAsString(), 'reference_code' => $exception instanceof FlowException ? $exception->getReferenceCode() : NULL, 'response_status' => $statusCode, 'short_message' => sprintf('%d %s', $statusCode, Response::getStatusMessageByCode($statusCode)), 'code' => $exception->getCode(), 'file' => $exception->getFile(), 'line' => $exception->getLine());
if ($this->securityContext !== NULL && $this->securityContext->isInitialized()) {
$account = $this->securityContext->getAccount();
if ($account !== NULL) {
$messageContext['authenticated_account'] = $account->getAccountIdentifier() . ' (' . $this->persistenceManager->getIdentifierByObject($account) . ')';
$messageContext['authenticated_roles'] = implode(', ', array_keys($this->securityContext->getRoles()));
if ($this->objectManager->isRegistered(PartyService::class)) {
/** @var PartyService $partyService */
$partyService = $this->objectManager->get(PartyService::class);
$person = $partyService->getAssignedPartyOfAccount($account);
if ($person instanceof Person) {
$messageContext['authenticated_person'] = (string) $person->getName() . ' (' . $this->persistenceManager->getIdentifierByObject($person) . ')';
}
}
}
}
// prepare request details
if (Bootstrap::$staticObjectManager instanceof ObjectManagerInterface) {
$bootstrap = Bootstrap::$staticObjectManager->get('TYPO3\\Flow\\Core\\Bootstrap');
/* @var Bootstrap $bootstrap */
$requestHandler = $bootstrap->getActiveRequestHandler();
if ($requestHandler instanceof HttpRequestHandlerInterface) {
$request = $requestHandler->getHttpRequest();
$requestData = array('request_domain' => $request->getHeader('Host'), 'request_remote_addr' => $request->getClientIpAddress(), 'request_path' => $request->getRelativePath(), 'request_uri' => $request->getUri()->getPath(), 'request_user_agent' => $request->getHeader('User-Agent'), 'request_method' => $request->getMethod(), 'request_port' => $request->getPort());
$messageContext = array_merge($messageContext, $requestData);
}
}
// send message to graylog server
$logger = new Logger($publisher);
$logger->log($logLevel, $exception->getMessage(), $messageContext);
}
示例8: hasStatusCode
public function hasStatusCode($expectedStatusCode)
{
$realStatusCode = $this->response->getStatusCode();
$this->test->assertSame($realStatusCode, $expectedStatusCode, 'Status Code was ' . $realStatusCode . ' (' . $this->response->getStatusMessageByCode($realStatusCode) . ') instead of ' . $expectedStatusCode . ':' . PHP_EOL . $this->response->getContent());
return $this;
}
示例9: getStatusLine
/**
* @return string
*/
public function getStatusLine()
{
return sprintf('HTTP/1.1 %d %s', $this->statusCode, HttpResponse::getStatusMessageByCode($this->statusCode));
}