Passed
Pull Request — master (#97)
by Maximilian
03:52
created

Experience   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 1
b 0
f 1
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A fromAmazonRequest() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Request;
6
7
class Experience
8
{
9
    /**
10
     * @param string|int|null $arcMinuteWidth Arc minute width
11
     * @param string|int|null $arcMinuteHeight Arc minute height
12
     * @param bool|null $canRotate Whether the experience can rotate
13
     * @param bool|null $canResize Whether the experience can resize
14
     */
15 2
    public function __construct(
16
        public string|int|null $arcMinuteWidth = null,
17
        public string|int|null $arcMinuteHeight = null,
18
        public ?bool $canRotate = null,
19
        public ?bool $canResize = null,
20
    ) {
21 2
    }
22
23 2
    public static function fromAmazonRequest(array $amazonRequest): self
24
    {
25 2
        return new self(
26 2
            arcMinuteWidth: $amazonRequest['arcMinuteWidth'] ?? null,
27 2
            arcMinuteHeight: $amazonRequest['arcMinuteHeight'] ?? null,
28 2
            canRotate: $amazonRequest['canRotate'] ?? null,
29 2
            canResize: $amazonRequest['canResize'] ?? null,
30 2
        );
31
    }
32
}
33