本文整理汇总了PHP中HttpException::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpException::__construct方法的具体用法?PHP HttpException::__construct怎么用?PHP HttpException::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpException
的用法示例。
在下文中一共展示了HttpException::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Code and message positions are reverted.
*
* @param int $code
* @param string $message
*/
public function __construct($code = null, $message = "")
{
if (empty($code) && empty($this->code)) {
$code = self::NOT_FOUND;
}
parent::__construct($message, $code);
}
示例2: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Gone' will be the message
* @param int $code Status code, defaults to 410
*/
public function __construct($message = null, $code = 410)
{
if (empty($message)) {
$message = 'Gone';
}
parent::__construct($message, $code);
}
示例3: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Not Acceptable' will be the message
* @param int $code Status code, defaults to 406
*/
public function __construct($message = null, $code = 406)
{
if (empty($message)) {
$message = 'Not Acceptable';
}
parent::__construct($message, $code);
}
示例4: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Unavailable For Legal Reasons' will be the message
* @param int $code Status code, defaults to 451
*/
public function __construct($message = null, $code = 451)
{
if (empty($message)) {
$message = 'Unavailable For Legal Reasons';
}
parent::__construct($message, $code);
}
示例5: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Service Unavailable' will be the message
* @param int $code Status code, defaults to 503
*/
public function __construct($message = null, $code = 503)
{
if (empty($message)) {
$message = 'Service Unavailable';
}
parent::__construct($message, $code);
}
示例6: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Invalid CSRF Token' will be the message
* @param int $code Status code, defaults to 403
*/
public function __construct($message = null, $code = 403)
{
if (empty($message)) {
$message = 'Invalid CSRF Token';
}
parent::__construct($message, $code);
}
示例7: __construct
public function __construct($message = '', $code = 0, \Exception $previous = null)
{
if (!$message) {
$message = 'Forbidden';
}
parent::__construct($message, 403, $previous);
}
示例8: __construct
/**
* Class constructor.
*
* @param string $location The redirect URL.
* @param int $statusCode The HTTP status code, 3XX.
* @param string $message An optional exception message for debugging.
* @param \Throwable|null $previous An optional previous exception for chaining.
*
* @throws \RuntimeException
*/
public function __construct($location, $statusCode = 302, $message = '', \Throwable $previous = null)
{
if ($statusCode < 300 || $statusCode >= 400) {
throw new \RuntimeException('Invalid HTTP redirect status code: ' . $statusCode);
}
parent::__construct($statusCode, ['Location' => $location]);
}
示例9: __construct
public function __construct($message = null, $code = 404)
{
if (empty($message)) {
$message = 'Not Found';
}
parent::__construct($message, $code);
}
示例10: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Bad Request' will be the message
* @param int $code Status code, defaults to 400
*/
public function __construct($message = null, $code = 400)
{
if (empty($message)) {
$message = 'Bad Request';
}
parent::__construct($message, $code);
}
示例11: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Unauthorized' will be the message
* @param int $code Status code, defaults to 401
*/
public function __construct($message = null, $code = 401)
{
if (empty($message)) {
$message = 'Unauthorized';
}
parent::__construct($message, $code);
}
示例12: __construct
/**
* @param string $location
* @param integer $statusCode
* @param string $message
* @param \Exception|null $previous
*/
public function __construct($location, $statusCode = 302, $message = '', \Exception $previous = null)
{
if ($statusCode < 300 || $statusCode >= 400) {
throw new \InvalidArgumentException('Invalid HTTP redirect status code: ' . $statusCode);
}
parent::__construct($statusCode, ['Location' => $location], $message, $previous);
}
示例13: __construct
public function __construct($message = '')
{
if (!$message) {
$message = 'Forbidden';
}
parent::__construct($message, 403);
}
示例14: __construct
/**
* Constructor
*
* @param string|null $message If no message is given 'Method Not Allowed' will be the message
* @param int $code Status code, defaults to 405
*/
public function __construct($message = null, $code = 405)
{
if (empty($message)) {
$message = 'Method Not Allowed';
}
parent::__construct($message, $code);
}
示例15: __construct
public function __construct($message = '', $code = 0, \Exception $previous = null)
{
if (!$message) {
$message = 'Not Found';
}
parent::__construct($message, 404, $previous);
}