Conditions | 4 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
21 | 2 | public static function fromAmazonRequest(array $amazonRequest): self |
|
22 | { |
||
23 | 2 | $componentsVisibleOnScreen = null; |
|
24 | 2 | if (isset($amazonRequest['componentsVisibleOnScreen']) && is_array($amazonRequest['componentsVisibleOnScreen'])) { |
|
25 | 2 | $componentsVisibleOnScreen = []; |
|
26 | 2 | foreach ($amazonRequest['componentsVisibleOnScreen'] as $componentData) { |
|
27 | 2 | $componentsVisibleOnScreen[] = ComponentVisibleOnScreen::fromAmazonRequest($componentData); |
|
28 | } |
||
29 | } |
||
30 | |||
31 | 2 | return new self( |
|
32 | 2 | token: $amazonRequest['token'] ?? null, |
|
33 | 2 | version: $amazonRequest['version'] ?? null, |
|
34 | 2 | componentsVisibleOnScreen: $componentsVisibleOnScreen, |
|
35 | 2 | ); |
|
38 |