class NotifyException extends Exception implements Responsable, HttpExceptionInterface
{
public $message;
- public $redirectLocation;
- protected $status;
-
- /**
- * @var array<mixed>
- */
- protected array $headers = [];
+ public string $redirectLocation;
+ protected int $status;
public function __construct(string $message, string $redirectLocation = '/', int $status = 500)
{
$this->redirectLocation = $redirectLocation;
$this->status = $status;
- if ($status >= 300 && $status < 400) {
- // add redirect header only when a matching HTTP status is given
- $this->headers = ['location' => $redirectLocation];
- }
-
parent::__construct();
}
/**
* Get the desired HTTP status code for this exception.
- *
- * {@inheritdoc}
*/
public function getStatusCode(): int
{
/**
* Get the desired HTTP headers for this exception.
- *
- * {@inheritdoc}
*/
public function getHeaders(): array
{
- return $this->headers;
- }
-
- /**
- * @param array<mixed> $headers
- */
- public function setHeaders(array $headers): void
- {
- $this->headers = $headers;
+ return [];
}
/**
class PrettyException extends Exception implements Responsable, HttpExceptionInterface
{
- /**
- * @var ?string
- */
- protected $subtitle = null;
-
- /**
- * @var ?string
- */
- protected $details = null;
-
- /**
- * @var array
- */
- protected $headers = [];
+ protected ?string $subtitle = null;
+ protected ?string $details = null;
/**
* Render a response for when this exception occurs.
/**
* Get the desired HTTP headers for this exception.
- * @return array<mixed>
*/
public function getHeaders(): array
{
- return $this->headers;
- }
-
- /**
- * Set the desired HTTP headers for this exception.
- * @param array<mixed> $headers
- */
- public function setHeaders(array $headers): void
- {
- $this->headers = $headers;
+ return [];
}
}