summaryrefslogtreecommitdiff
path: root/src/Http
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-11-13 17:48:07 +0100
committermsquare <msquare@notrademark.de>2018-12-02 12:53:31 +0100
commit9788c5095a67a45fe3545ae0fc747b8e629ea4fd (patch)
treeac6edc92fcf08c40d4b517529a76ab9f230829f0 /src/Http
parent2588bbf7bc5374830662af7c01df688c42d30dc6 (diff)
Implemented HttpException
Diffstat (limited to 'src/Http')
-rw-r--r--src/Http/Exceptions/HttpException.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/Http/Exceptions/HttpException.php b/src/Http/Exceptions/HttpException.php
new file mode 100644
index 00000000..07853d1e
--- /dev/null
+++ b/src/Http/Exceptions/HttpException.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Engelsystem\Http\Exceptions;
+
+use RuntimeException;
+use Throwable;
+
+class HttpException extends RuntimeException
+{
+ /** @var int */
+ protected $statusCode;
+
+ /** @var array */
+ protected $headers = [];
+
+ /**
+ * @param int $statusCode
+ * @param string $message
+ * @param array $headers
+ * @param int $code
+ * @param Throwable|null $previous
+ */
+ public function __construct(
+ int $statusCode,
+ string $message = '',
+ array $headers = [],
+ int $code = 0,
+ Throwable $previous = null
+ ) {
+ $this->headers = $headers;
+ $this->statusCode = $statusCode;
+
+ parent::__construct($message, $code, $previous);
+ }
+
+ /**
+ * @return array
+ */
+ public function getHeaders(): array
+ {
+ return $this->headers;
+ }
+
+ /**
+ * @return int
+ */
+ public function getStatusCode(): int
+ {
+ return $this->statusCode;
+ }
+} \ No newline at end of file