FOSSology  4.4.0
Open Source License Compliance by Open Source Software
HttpErrorException.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Siemens AG
4  SPDX-FileContributor: Gaurav Mishra <mishra.gaurav@siemens.com>
5 
6  SPDX-License-Identifier: GPL-2.0-only
7  */
8 
9 namespace Fossology\UI\Api\Exceptions;
10 
11 use Exception;
12 use Psr\Http\Message\ServerRequestInterface;
13 use Throwable;
14 
18 class HttpErrorException extends Exception
19 {
24  protected ServerRequestInterface $request;
29  protected array $headers = [];
30 
31  public function __construct(string $message, int $code,
32  ?Throwable $previous = null)
33  {
34  parent::__construct($message, $code, $previous);
35  }
36 
40  public function getRequest(): ServerRequestInterface
41  {
42  return $this->request;
43  }
44 
49  public function setHeaders(array $headers): HttpErrorException
50  {
51  $this->headers = $headers;
52  return $this;
53  }
54 
58  public function getHeaders(): array
59  {
60  return $this->headers;
61  }
62 }