ResponseWriterFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 18
ccs 10
cts 10
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createXmlResponseWriter() 0 8 1
A createJsonResponseWriter() 0 5 1
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