GuzzleMessageFactory::createResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 5
dl 0
loc 13
ccs 6
cts 6
cp 1
crap 1
rs 10
c 1
b 0
f 0
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