LicenseResponder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
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 31
ccs 12
cts 12
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A isBinaryResponder() 0 3 1
A writeJson() 0 3 1
A writeXml() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Usox\HyperSonic\FeatureSet\V1161\Responder;
6
7
use AaronDDM\XMLBuilder\XMLArray;
8
use Usox\HyperSonic\Response\FormattedResponderInterface;
9
10
final class LicenseResponder implements FormattedResponderInterface
11
{
12
    /**
13
     * @param array{
14
     *  valid: string,
15
     *  email: string,
16
     *  licenseExpires: string
17
     * } $licenseData
18
     */
19 4
    public function __construct(
20
        private readonly array $licenseData
21
    ) {
22 4
    }
23
24 1
    public function writeXml(XMLArray $XMLArray): void
25
    {
26 1
        $XMLArray->add(
27 1
            'license',
28 1
            null,
29 1
            $this->licenseData
30 1
        );
31
    }
32
33 1
    public function writeJson(array &$root): void
34
    {
35 1
        $root['license'] = $this->licenseData;
36
    }
37
38 1
    public function isBinaryResponder(): bool
39
    {
40 1
        return false;
41
    }
42
}
43