GuzzleMessageFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 37
ccs 14
cts 14
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createRequest() 0 13 1
A createResponse() 0 13 1
1
<?php
2
3
namespace Http\Message\MessageFactory;
4
5
use GuzzleHttp\Psr7\Request;
6
use GuzzleHttp\Psr7\Response;
7
use Http\Message\MessageFactory;
8
9
/**
10
 * Creates Guzzle messages.
11
 *
12
 * @author Márk Sági-Kazár <[email protected]>
13
 *
14
 * @deprecated This will be removed in php-http/message2.0. Consider using the official Guzzle PSR-17 factory
15
 */
16
final class GuzzleMessageFactory implements MessageFactory
17
{
18
    /**
19 1
     * {@inheritdoc}
20
     */
21
    public function createRequest(
22
        $method,
23
        $uri,
24
        array $headers = [],
25
        $body = null,
26 1
        $protocolVersion = '1.1'
27 1
    ) {
28 1
        return new Request(
29 1
            $method,
30 1
            $uri,
31 1
            $headers,
32
            $body,
33
            $protocolVersion
34
        );
35
    }
36
37
    /**
38 1
     * {@inheritdoc}
39
     */
40
    public function createResponse(
41
        $statusCode = 200,
42
        $reasonPhrase = null,
43
        array $headers = [],
44
        $body = null,
45 1
        $protocolVersion = '1.1'
46 1
    ) {
47 1
        return new Response(
48 1
            $statusCode,
49 1
            $headers,
50 1
            $body,
51
            $protocolVersion,
52
            $reasonPhrase
53
        );
54
    }
55
}
56