We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f42358 commit 17358f0Copy full SHA for 17358f0
src/Headers/HttpAuthorizationHeader.php
@@ -0,0 +1,31 @@
1
+<?php
2
+
3
+declare(strict_types=1);
4
5
+namespace WrkFlow\ApiSdkBuilder\Headers;
6
7
+use WrkFlow\ApiSdkBuilder\Interfaces\HeadersInterface;
8
9
+class HttpAuthorizationHeader implements HeadersInterface
10
+{
11
+ public function __construct(
12
+ public readonly string $username,
13
+ public readonly string $password,
14
+ ) {
15
+ }
16
17
+ public function headers(): array
18
+ {
19
+ $key = base64_encode(
20
+ sprintf(
21
+ '%s:%s',
22
+ $this->username,
23
+ $this->password,
24
+ ),
25
+ );
26
27
+ return [
28
+ 'Authorization' => sprintf('Basic %s', $key),
29
+ ];
30
31
+}
0 commit comments