Completed
Pull Request — master (#123)
by David
01:53
created

Header::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Http\Message\Authentication;
4
5
use Http\Message\Authentication;
6
use Psr\Http\Message\RequestInterface;
7
8
class Header implements Authentication
9
{
10
    /**
11
     * @var string
12
     */
13
    private $name;
14
15
    /**
16
     * @var string|array
17
     */
18
    private $value;
19
20 3
    public function __construct(string $name, $value)
21
    {
22 3
        $this->name = $name;
23 3
        $this->value = $value;
24 3
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 1
    public function authenticate(RequestInterface $request)
30
    {
31 1
        return $request->withHeader($this->name, $this->value);
32
    }
33
}
34