ScrollableTag   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromAmazonRequest() 0 6 2
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Request;
6
7
class ScrollableTag
8
{
9
    /**
10
     * @param ScrollDirection|null $direction Scroll direction
11
     * @param bool|null $allowForward Whether forward scrolling is allowed
12
     * @param bool|null $allowBackwards Whether backward scrolling is allowed
13
     */
14 3
    public function __construct(
15
        public ?ScrollDirection $direction = null,
16
        public ?bool $allowForward = null,
17
        public ?bool $allowBackwards = null,
18
    ) {
19 3
    }
20
21 3
    public static function fromAmazonRequest(array $amazonRequest): self
22
    {
23 3
        return new self(
24 3
            direction: isset($amazonRequest['direction']) ? ScrollDirection::tryFrom($amazonRequest['direction']) : null,
25 3
            allowForward: $amazonRequest['allowForward'] ?? null,
26 3
            allowBackwards: $amazonRequest['allowBackwards'] ?? null,
27 3
        );
28
    }
29
}
30