WrongCredentialsException.php 644 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. // Copyright 2019 Hackware SpA <human@hackware.cl>
  3. // "Hackware Web Services Core" is released under the MIT License terms.
  4. namespace Hawese\Core\Exceptions;
  5. use RuntimeException;
  6. class WrongCredentialsException extends RuntimeException
  7. {
  8. protected $statusCode;
  9. public function __construct($model, $identifier)
  10. {
  11. $identifier = htmlspecialchars($identifier);
  12. parent::__construct(
  13. "Wrong secret for $model $identifier", // message
  14. 4 // code
  15. );
  16. $this->statusCode = 403;
  17. }
  18. public function getStatusCode(): int
  19. {
  20. return $this->statusCode;
  21. }
  22. }