Completed
Push — master ( 4e07a2...96fcad )
by Tobias
03:18
created

MessageFactory::createResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 5
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Nyholm\Psr7\Factory;
6
7
use Nyholm\Psr7\Request;
8
use Nyholm\Psr7\Response;
9
10
/**
11
 * @author Tobias Nyholm <[email protected]>
12
 */
13
class MessageFactory implements \Http\Message\MessageFactory
14
{
15
    public function createRequest(
16
        $method,
17
        $uri,
18
        array $headers = [],
19
        $body = null,
20
        $protocolVersion = '1.1'
21
    ) {
22
        return new Request($method, $uri, $headers, $body, $protocolVersion);
23
    }
24
25
    public function createResponse(
26
        $statusCode = 200,
27
        $reasonPhrase = null,
28
        array $headers = [],
29
        $body = null,
30
        $protocolVersion = '1.1'
31
    ) {
32
        return new Response((int) $statusCode, $headers, $body, $protocolVersion, $reasonPhrase);
33
    }
34
}
35