ResponseWriterFactory::createJsonResponseWriter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Usox\HyperSonic\Response;
6
7
use AaronDDM\XMLBuilder\Writer\XMLWriterService;
8
use AaronDDM\XMLBuilder\XMLBuilder;
9
10
/**
11
 * Create the response writes classes depending on the requested format
12
 */
13
final class ResponseWriterFactory implements ResponseWriterFactoryInterface
14
{
15 1
    public function createXmlResponseWriter(
16
        string $apiVersion
17
    ): ResponseWriterInterface {
18 1
        return new XmlResponseWriter(
19 1
            new XMLBuilder(
20 1
                new XMLWriterService()
21 1
            ),
22 1
            $apiVersion,
23 1
        );
24
    }
25
26 1
    public function createJsonResponseWriter(
27
        string $apiVersion
28
    ): ResponseWriterInterface {
29 1
        return new JsonResponseWriter(
30 1
            $apiVersion
31 1
        );
32
    }
33
}
34