UnauthorizedException.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * UnauthorizedException class
  4. *
  5. * PHP 5
  6. *
  7. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * Redistributions of files must retain the above copyright notice.
  12. *
  13. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  14. * @link http://book.cakephp.org/2.0/en/development/testing.html
  15. * @since 3.0.0
  16. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  17. */
  18. namespace Cake\Error;
  19. /**
  20. * Represents an HTTP 401 error.
  21. *
  22. */
  23. class UnauthorizedException extends HttpException {
  24. /**
  25. * Constructor
  26. *
  27. * @param string $message If no message is given 'Unauthorized' will be the message
  28. * @param integer $code Status code, defaults to 401
  29. */
  30. public function __construct($message = null, $code = 401) {
  31. if (empty($message)) {
  32. $message = 'Unauthorized';
  33. }
  34. parent::__construct($message, $code);
  35. }
  36. }