Total Complexity | 3 |
Total Lines | 54 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | final class SlimMessageFactory implements MessageFactory |
||
20 | { |
||
21 | /** |
||
22 | * @var SlimStreamFactory |
||
23 | */ |
||
24 | private $streamFactory; |
||
25 | |||
26 | /** |
||
27 | * @var SlimUriFactory |
||
28 | */ |
||
29 | 4 | private $uriFactory; |
|
30 | |||
31 | 4 | public function __construct() |
|
32 | 4 | { |
|
33 | 4 | $this->streamFactory = new SlimStreamFactory(); |
|
|
|||
34 | $this->uriFactory = new SlimUriFactory(); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | 1 | * {@inheritdoc} |
|
39 | */ |
||
40 | public function createRequest( |
||
41 | $method, |
||
42 | $uri, |
||
43 | array $headers = [], |
||
44 | $body = null, |
||
45 | 1 | $protocolVersion = '1.1' |
|
46 | 1 | ) { |
|
47 | 1 | return (new Request( |
|
48 | 1 | $method, |
|
49 | 1 | $this->uriFactory->createUri($uri), |
|
50 | 1 | new Headers($headers), |
|
51 | 1 | [], |
|
52 | 1 | [], |
|
53 | 1 | $this->streamFactory->createStream($body), |
|
54 | [] |
||
55 | ))->withProtocolVersion($protocolVersion); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | 1 | * {@inheritdoc} |
|
60 | */ |
||
61 | public function createResponse( |
||
73 | } |
||
74 | } |
||
75 |