Passed
Pull Request — master (#97)
by Maximilian
04:02
created

PseudoLocalization   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A jsonSerialize() 0 12 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\Document;
6
7
class PseudoLocalization implements \JsonSerializable
8
{
9 13
    public function __construct(
10
        public bool $enabled = false,
11
        public int $expansionPercentage = 30,
12
    ) {
13 13
    }
14
15 9
    public function jsonSerialize(): array
16
    {
17 9
        $data = [];
18
19 9
        if ($this->enabled) {
20 5
            $data['enabled'] = $this->enabled;
21
        }
22 9
        if ($this->expansionPercentage !== 30) {
23 5
            $data['expansionPercentage'] = $this->expansionPercentage;
24
        }
25
26 9
        return $data;
27
    }
28
}
29