UnknownForeignObjectException.php 776 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 Exception;
  6. class UnknownForeignObjectException extends Exception
  7. {
  8. protected $detail = [];
  9. protected $statusCode;
  10. public function __construct($model, $attribute)
  11. {
  12. parent::__construct(
  13. 'Unknown foreign object', // message
  14. 2 // code
  15. );
  16. $this->statusCode = 400;
  17. $this->detail = [
  18. 'model' => $model,
  19. 'attribute' => $attribute
  20. ];
  21. }
  22. public function getStatusCode(): int
  23. {
  24. return $this->statusCode;
  25. }
  26. public function getDetail()
  27. {
  28. return $this->detail;
  29. }
  30. }