TypeValue   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 7 1
A __construct() 0 5 1
A create() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\Dialog\Entity;
6
7
class TypeValue implements \JsonSerializable
8
{
9 3
    public function __construct(
10
        public string $id = '',
11
        public string $value = '',
12
        public array $synonyms = []
13
    ) {
14 3
    }
15
16 3
    public static function create(string $id, string $value, array $synonyms = []): self
17
    {
18 3
        return new self($id, $value, $synonyms);
19
    }
20
21 3
    public function jsonSerialize(): array
22
    {
23 3
        return [
24 3
            'id' => $this->id,
25 3
            'name' => [
26 3
                'value' => $this->value,
27 3
                'synonyms' => $this->synonyms,
28 3
            ],
29 3
        ];
30
    }
31
}
32