Speed::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 2
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Request;
6
7
/**
8
 * @deprecated
9
 */
10
class Speed
11
{
12
    /**
13
     * @param float $speedInMetersPerSecond Speed in meters per second
14
     * @param float|null $accuracyInMetersPerSecond Accuracy of speed measurement in meters per second
15
     */
16 1
    public function __construct(
17
        public float $speedInMetersPerSecond,
18
        public ?float $accuracyInMetersPerSecond = null,
19
    ) {
20 1
    }
21
22 1
    public static function fromAmazonRequest(array $amazonRequest): self
23
    {
24 1
        return new self(
25 1
            speedInMetersPerSecond: (float) ($amazonRequest['speedInMetersPerSecond']),
26 1
            accuracyInMetersPerSecond: isset($amazonRequest['accuracyInMetersPerSecond']) ? (float) ($amazonRequest['accuracyInMetersPerSecond']) : null,
27 1
        );
28
    }
29
}
30