Passed
Push — master ( 0dc587...d0f7b8 )
by Maximilian
45s queued 10s
created

Event   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromAmazonRequest() 0 11 2
1
<?php
2
3
namespace MaxBeckers\AmazonAlexa\Request\Request\GameEngine\Event;
4
5
/**
6
 * @author Fabian Graßl <[email protected]>
7
 */
8
class Event
9
{
10
    /**
11
     * @var string
12
     */
13
    public $name;
14
15
    /**
16
     * @var array
17
     */
18
    public $inputEvents = [];
19
20
    /**
21
     * @param array $amazonRequest
22
     *
23
     * @return Event
24
     */
25
    public static function fromAmazonRequest(array $amazonRequest): self
26
    {
27
        $event = new self();
28
29
        $event->name  = $amazonRequest['name'];
30
31
        foreach ($amazonRequest['inputEvents'] as $_event) {
32
            $event->inputEvents[] = InputEvent::fromAmazonRequest($_event);
33
        }
34
35
        return $event;
36
    }
37
}
38