Passed
Pull Request — master (#7)
by Laurens
05:33
created

HttpBasic   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getHeader() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Werkspot\KvkApi\Client\Authentication;
6
7
final class HttpBasic implements AuthenticationInterface
8
{
9
    private $username;
10
11
    private $password;
12
13 19
    public function __construct(string $username, string $password)
14
    {
15 19
        $this->username = $username;
16 19
        $this->password = $password;
17 19
    }
18
19 19
    public function getHeader(): string
20
    {
21 19
        $hash = base64_encode(sprintf('%s:%s', $this->username, $this->password));
22
23 19
        return sprintf('Authorization:Basic %s', $hash);
24
    }
25
}
26