Browse code

Added README.md appinfo/info.xml appinfo/signature.json lib/Controller/AuthorApiController.php and the providers directory

DoubleBastionAdmin authored on 20/08/2022 16:33:00
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,76 @@
1
+<?php
2
+
3
+namespace Telnyx\Exception;
4
+
5
+/**
6
+ * SignatureVerificationException is thrown when the signature verification for
7
+ * a webhook fails.
8
+ *
9
+ * @package Telnyx\Exception
10
+ */
11
+class SignatureVerificationException extends \Exception implements ExceptionInterface
12
+{
13
+    protected $httpBody;
14
+    protected $sigHeader;
15
+
16
+    /**
17
+     * Creates a new SignatureVerificationException exception.
18
+     *
19
+     * @param string $message The exception message.
20
+     * @param string|null $httpBody The HTTP body as a string.
21
+     * @param string|null $sigHeader The `Telnyx-Signature` HTTP header.
22
+     *
23
+     * @return SignatureVerificationException
24
+     */
25
+    public static function factory(
26
+        $message,
27
+        $httpBody = null,
28
+        $sigHeader = null
29
+    ) {
30
+        $instance = new static($message);
31
+        $instance->setHttpBody($httpBody);
32
+        $instance->setSigHeader($sigHeader);
33
+
34
+        return $instance;
35
+    }
36
+
37
+    /**
38
+     * Gets the HTTP body as a string.
39
+     *
40
+     * @return string|null
41
+     */
42
+    public function getHttpBody()
43
+    {
44
+        return $this->httpBody;
45
+    }
46
+
47
+    /**
48
+     * Sets the HTTP body as a string.
49
+     *
50
+     * @param string|null $httpBody
51
+     */
52
+    public function setHttpBody($httpBody)
53
+    {
54
+        $this->httpBody = $httpBody;
55
+    }
56
+
57
+    /**
58
+     * Gets the `Telnyx-Signature` HTTP header.
59
+     *
60
+     * @return string|null
61
+     */
62
+    public function getSigHeader()
63
+    {
64
+        return $this->sigHeader;
65
+    }
66
+
67
+    /**
68
+     * Sets the `Telnyx-Signature` HTTP header.
69
+     *
70
+     * @param string|null $sigHeader
71
+     */
72
+    public function setSigHeader($sigHeader)
73
+    {
74
+        $this->sigHeader = $sigHeader;
75
+    }
76
+}