Passed
Push — main ( a2d9fb...be9758 )
by Daniel
02:34
created

ResponseWriterFactory   A

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
wmc 2
eloc 7
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0

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
final class ResponseWriterFactory implements ResponseWriterFactoryInterface
11
{
12 1
    public function createXmlResponseWriter(
13
        string $apiVersion
14
    ): ResponseWriterInterface {
15 1
        return new XmlResponseWriter(
16 1
            new XMLBuilder(
17 1
                new XMLWriterService()
18
            ),
19
            $apiVersion,
20
        );
21
    }
22
23 1
    public function createJsonResponseWriter(
24
        string $apiVersion
25
    ): ResponseWriterInterface {
26 1
        return new JsonResponseWriter(
27
            $apiVersion
28
        );
29
    }
30
}
31