Completed
Push — PSR-11-2 ( a5ad88...7f5041 )
by Nikolaos
03:59
created

ResponseFactory::createResponse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.2963

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
ccs 2
cts 6
cp 0.3333
rs 10
cc 1
nc 1
nop 2
crap 1.2963
1
<?php
2
3
/**
4
 * This file is part of the Phalcon Framework.
5
 *
6
 * (c) Phalcon Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 *
11
 * Implementation of this file has been influenced by Zend Diactoros
12
 *
13
 * @link    https://github.com/zendframework/zend-diactoros
14
 * @license https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md
15
 */
16
17
declare(strict_types=1);
18
19
namespace Phalcon\Http\Message;
20
21
use Psr\Http\Message\ResponseFactoryInterface;
22
use Psr\Http\Message\ResponseInterface;
23
24
/**
25
 * PSR-17 ResponseFactory
26
 */
27
final class ResponseFactory implements ResponseFactoryInterface
28
{
29
    /**
30
     * Create a new response.
31
     *
32
     * @param int    $code         The HTTP status code. Defaults to 200.
33
     * @param string $reasonPhrase The reason phrase to associate with the
34
     *                             status code in the generated response. If
35
     *                             none is provided, implementations MAY use
36
     *                             the defaults as suggested in the HTTP
37
     *                             specification.
38
     *
39
     * @return ResponseInterface
40
     */
41 1
    public function createResponse(
42
        int $code = 200,
43
        string $reasonPhrase = ""
44
    ): ResponseInterface {
45 1
        return (new Response())->withStatus($code, $reasonPhrase);
46
    }
47
}
48