ForbiddenHttpException.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\web;
  8. /**
  9. * ForbiddenHttpException represents a "Forbidden" HTTP exception with status code 403.
  10. *
  11. * Use this exception when a user is not allowed to perform the requested action.
  12. * Using different credentials might or might not allow performing the requested action.
  13. * If you do not want to expose authorization information to the user, it is valid
  14. * to respond with a 404 [[NotFoundHttpException]].
  15. *
  16. * @see https://tools.ietf.org/html/rfc7231#section-6.5.3
  17. * @author Dan Schmidt <danschmidt5189@gmail.com>
  18. * @since 2.0
  19. */
  20. class ForbiddenHttpException extends HttpException
  21. {
  22. /**
  23. * Constructor.
  24. * @param string $message error message
  25. * @param int $code error code
  26. * @param \Exception $previous The previous exception used for the exception chaining.
  27. */
  28. public function __construct($message = null, $code = 0, \Exception $previous = null)
  29. {
  30. parent::__construct(403, $message, $code, $previous);
  31. }
  32. }