PagerTag   A
last analyzed

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
c 1
b 0
f 1
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

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