TypeValue   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
A jsonSerialize() 0 7 1
1
<?php
2
3
namespace MaxBeckers\AmazonAlexa\Response\Directives\Dialog\Entity;
4
5
class TypeValue implements \JsonSerializable
6
{
7
    /**
8
     * @var string
9
     */
10
    public $id;
11
12
    /**
13
     * @var string
14
     */
15
    public $value;
16
17
    /**
18
     * @var array
19
     */
20
    public $synonyms;
21
22
    /**
23
     * @param string $id
24
     * @param string $value
25
     * @param array  $synonyms
26
     *
27
     * @return TypeValue
28
     */
29 3
    public static function create(string $id, string $value, array $synonyms = []): self
30
    {
31 3
        $typeValue = new self();
32
33 3
        $typeValue->id       = $id;
34 3
        $typeValue->value    = $value;
35 3
        $typeValue->synonyms = $synonyms;
36
37 3
        return $typeValue;
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43 3
    public function jsonSerialize()
44
    {
45 3
        return [
46 3
            'id'   => $this->id,
47 3
            'name' => [
48 3
                'value'    => $this->value,
49 3
                'synonyms' => $this->synonyms,
50 3
            ],
51 3
        ];
52
    }
53
}
54