本文整理汇总了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));
}