ResponseFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createResponse() 0 8 2
1
<?php
2
declare(strict_types=1);
3
namespace Bnf\Typo3HttpFactory;
4
5
use Psr\Http\Message\ResponseFactoryInterface;
6
use Psr\Http\Message\ResponseInterface;
7
use TYPO3\CMS\Core\Http\Response;
8
9
final class ResponseFactory implements ResponseFactoryInterface
10
{
11
    public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
12
    {
13
        $response = new Response('php://temp', $code);
14
        if ($reasonPhrase !== '') {
15
            $response = $response->withStatus($code, $reasonPhrase);
16
        }
17
18
        return $response;
19
    }
20
}
21