Размер файла: 1.79Kb
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @license https://github.com/slimphp/Slim/blob/4.x/LICENSE.md (MIT License)
*/
declare(strict_types=1);
namespace Slim\Exception;
use Psr\Http\Message\ServerRequestInterface;
use RuntimeException;
use Throwable;
/**
* @method int getCode()
*/
class HttpException extends RuntimeException
{
/**
* @var ServerRequestInterface
*/
protected $request;
/**
* @var string
*/
protected $title = '';
/**
* @var string
*/
protected $description = '';
/**
* @param ServerRequestInterface $request
* @param string $message
* @param int $code
* @param Throwable|null $previous
*/
public function __construct(
ServerRequestInterface $request,
string $message = '',
int $code = 0,
?Throwable $previous = null
) {
parent::__construct($message, $code, $previous);
$this->request = $request;
}
/**
* @return ServerRequestInterface
*/
public function getRequest(): ServerRequestInterface
{
return $this->request;
}
/**
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
/**
* @param string $title
* @return self
*/
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
/**
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* @param string $description
* @return self
*/
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
}