Skip to content

Commit cbb1275

Browse files
committed
Updated AbstractAuthorizationHeader
1 parent ef54898 commit cbb1275

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/headers/AbstractAuthorizationHeader.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
abstract class AbstractAuthorizationHeader implements HeaderInterface
66
{
7-
public abstract function withCredentials(string $credentials);
87
public static abstract function getAuthorizationType() : string;
8+
public abstract function withCredentials(string $credentials);
9+
public abstract function getCredentials() : string;
10+
public function getType() : string
11+
{
12+
return static::getAuthorizationType();
13+
}
914
}

src/headers/BasicAuthorizationHeader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ public function withCredentials(string $credentials)
2323
$new->password = $parts[1];
2424
return $new;
2525
}
26+
public function getCredentials(): string
27+
{
28+
return $this->user . ':' . $this->password;
29+
}
2630

2731
public function withUser(string $user)
2832
{

src/headers/BearerAuthorizationHeader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ public function withCredentials(string $credentials)
1515
$new->token = $credentials;
1616
return $new;
1717
}
18+
public function getCredentials(): string
19+
{
20+
return $this->token;
21+
}
1822
public function withToken(string $token)
1923
{
2024
$new = clone $this;

0 commit comments

Comments
 (0)