1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Mosaic\Http\Adapters\Psr7; |
4
|
|
|
|
5
|
|
|
use Psr\Http\Message\MessageInterface; |
6
|
|
|
use Psr\Http\Message\StreamInterface; |
7
|
|
|
|
8
|
|
|
abstract class Message implements MessageInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var MessageInterface |
12
|
|
|
*/ |
13
|
|
|
protected $wrapped; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Message constructor. |
17
|
|
|
* @param MessageInterface $wrapped |
18
|
|
|
*/ |
19
|
106 |
|
public function __construct(MessageInterface $wrapped) |
20
|
|
|
{ |
21
|
106 |
|
$this->wrapped = $wrapped; |
22
|
106 |
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
*/ |
27
|
1 |
|
public function getProtocolVersion() |
28
|
|
|
{ |
29
|
1 |
|
return $this->getWrapped()->getProtocolVersion(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* {@inheritdoc} |
34
|
|
|
*/ |
35
|
1 |
|
public function withProtocolVersion($version) |
36
|
|
|
{ |
37
|
1 |
|
return new static($this->getWrapped()->withProtocolVersion($version)); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritdoc} |
42
|
|
|
*/ |
43
|
1 |
|
public function getHeaders() |
44
|
|
|
{ |
45
|
1 |
|
return $this->getWrapped()->getHeaders(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* {@inheritdoc} |
50
|
|
|
*/ |
51
|
2 |
|
public function hasHeader($name) |
52
|
|
|
{ |
53
|
2 |
|
return $this->getWrapped()->hasHeader($name); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* {@inheritdoc} |
58
|
|
|
*/ |
59
|
1 |
|
public function getHeader($name) |
60
|
|
|
{ |
61
|
1 |
|
return $this->getWrapped()->getHeader($name); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* {@inheritdoc} |
66
|
|
|
*/ |
67
|
1 |
|
public function getHeaderLine($name) |
68
|
|
|
{ |
69
|
1 |
|
return $this->getWrapped()->getHeaderLine($name); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* {@inheritdoc} |
74
|
|
|
*/ |
75
|
1 |
|
public function withHeader($name, $value) |
76
|
|
|
{ |
77
|
1 |
|
return new static($this->getWrapped()->withHeader($name, $value)); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* {@inheritdoc} |
82
|
|
|
*/ |
83
|
1 |
|
public function withAddedHeader($name, $value) |
84
|
|
|
{ |
85
|
1 |
|
return new static($this->getWrapped()->withAddedHeader($name, $value)); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* {@inheritdoc} |
90
|
|
|
*/ |
91
|
1 |
|
public function withoutHeader($name) |
92
|
|
|
{ |
93
|
1 |
|
return new static($this->getWrapped()->withoutHeader($name)); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* {@inheritdoc} |
98
|
|
|
*/ |
99
|
1 |
|
public function getBody() |
100
|
|
|
{ |
101
|
1 |
|
return $this->getWrapped()->getBody(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* {@inheritdoc} |
106
|
|
|
*/ |
107
|
1 |
|
public function withBody(StreamInterface $body) |
108
|
|
|
{ |
109
|
1 |
|
return new static($this->getWrapped()->withBody($body)); |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return mixed |
114
|
|
|
*/ |
115
|
|
|
abstract protected function getWrapped(); |
116
|
|
|
} |
117
|
|
|
|