本文整理匯總了PHP中Symfony\Component\HttpKernel\Exception\HttpException::getLine方法的典型用法代碼示例。如果您正苦於以下問題:PHP HttpException::getLine方法的具體用法?PHP HttpException::getLine怎麽用?PHP HttpException::getLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\HttpKernel\Exception\HttpException
的用法示例。
在下文中一共展示了HttpException::getLine方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: renderHttpException
/**
* Render the given HttpException.
*
* @param \Symfony\Component\HttpKernel\Exception\HttpException $e
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function renderHttpException(HttpException $e)
{
$status = $e->getStatusCode();
if (view()->exists("csm::errors.{$status}")) {
return response()->view("errors.{$status}", ['message' => $e->getMessage(), 'line' => $e->getLine(), 'file' => $e->getFile(), 'code' => $status, 'bodyId' => 'error.' . $status], $status);
} else {
return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
}
}
示例2: testShouldExtractDataToPost
public function testShouldExtractDataToPost()
{
$parser = new ExceptionParser();
$eMessage = "Exception Test";
$exception = new HttpException(404, $eMessage);
$eTrace = $exception->getTrace();
$eLine = $exception->getLine();
$eFile = $exception->getFile();
$parser->parse($exception);
$reflection = new ReflectionObject($parser);
$stack = $reflection->getProperty('stack');
$stack->setAccessible(true);
$file = $reflection->getProperty('file');
$file->setAccessible(true);
$line = $reflection->getProperty('line');
$line->setAccessible(true);
$message = $reflection->getProperty('message');
$message->setAccessible(true);
$this->assertInternalType('array', $stack->getValue($parser));
$this->assertEquals($eMessage, $message->getValue($parser));
$this->assertEquals($eFile, $file->getValue($parser));
$this->assertEquals($eLine, $line->getValue($parser));
}