Entity::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 0
nc 1
nop 3
dl 0
loc 5
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Request;
6
7
class Entity
8
{
9
    /**
10
     * @param string|null $id Entity identifier
11
     * @param string|null $type Entity type
12
     * @param string|null $value Entity value
13
     */
14 3
    public function __construct(
15
        public ?string $id = null,
16
        public ?string $type = null,
17
        public ?string $value = null,
18
    ) {
19 3
    }
20
21 3
    public static function fromAmazonRequest(array $amazonRequest): self
22
    {
23 3
        return new self(
24 3
            id: $amazonRequest['id'] ?? null,
25 3
            type: $amazonRequest['type'] ?? null,
26 3
            value: $amazonRequest['value'] ?? null,
27 3
        );
28
    }
29
}
30