Passed
Push — main ( 83e8ed...8c5b75 )
by Thomas
13:12
created

WrapsMessage   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 65
ccs 18
cts 27
cp 0.6667
rs 10
wmc 11

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getHeaders() 0 3 1
A getHeaderLine() 0 3 1
A withoutHeader() 0 5 1
A getProtocolVersion() 0 3 1
A getHeader() 0 3 1
A withProtocolVersion() 0 5 1
A withHeader() 0 5 1
A withBody() 0 5 1
A hasHeader() 0 3 1
A getBody() 0 3 1
A withAddedHeader() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Conia\Http;
6
7
use Psr\Http\Message\StreamInterface as PsrStream;
8
9
trait WrapsMessage
10
{
11 1
    public function getProtocolVersion(): string
12
    {
13 1
        return $this->psr->getProtocolVersion();
14
    }
15
16
    public function withProtocolVersion(string $version): static
17
    {
18
        $this->psr = $this->psr->withProtocolVersion($version);
0 ignored issues
show
Bug Best Practice introduced by
The property psr does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
19
20
        return $this;
21
    }
22
23 1
    public function getHeaders(): array
24
    {
25 1
        return $this->psr->getHeaders();
26
    }
27
28 1
    public function hasHeader(string $header): bool
29
    {
30 1
        return $this->psr->hasHeader($header);
31
    }
32
33 1
    public function getHeader(string $header): array
34
    {
35 1
        return $this->psr->getHeader($header);
36
    }
37
38 2
    public function getHeaderLine(string $header): string
39
    {
40 2
        return $this->psr->getHeaderLine($header);
41
    }
42
43
    public function withHeader(string $header, string $value): static
44
    {
45
        $this->psr = $this->psr->withHeader($header, $value);
0 ignored issues
show
Bug Best Practice introduced by
The property psr does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
46
47
        return $this;
48
    }
49
50
    public function withAddedHeader(string $header, string $value): static
51
    {
52
        $this->psr = $this->psr->withAddedHeader($header, $value);
0 ignored issues
show
Bug Best Practice introduced by
The property psr does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
53
54
        return $this;
55
    }
56
57 1
    public function withoutHeader(string $header): static
58
    {
59 1
        $this->psr = $this->psr->withoutHeader($header);
0 ignored issues
show
Bug Best Practice introduced by
The property psr does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
60
61 1
        return $this;
62
    }
63
64 1
    public function getBody(): PsrStream
65
    {
66 1
        return $this->psr->getBody();
67
    }
68
69 1
    public function withBody(PsrStream $body): static
70
    {
71 1
        $this->psr = $this->psr->withBody($body);
0 ignored issues
show
Bug Best Practice introduced by
The property psr does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
72
73 1
        return $this;
74
    }
75
}
76