Passed
Pull Request — master (#33)
by Maximilian
03:06
created

Event::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 6
1
<?php
2
3
namespace MaxBeckers\AmazonAlexa\Response\Directives\GameEngine;
4
5
/**
6
 * @author Maximilian Beckers <[email protected]>
7
 */
8
class Event
9
{
10
    const REPORTS_HISTORY = 'history';
11
    const REPORTS_MATCHES = 'matches';
12
    const REPORTS_NOTHING = 'nothing';
13
14
    /**
15
     * @var array
16
     */
17
    public $meets = [];
18
19
    /**
20
     * @var array
21
     */
22
    public $fails = [];
23
24
    /**
25
     * @var string|null
26
     */
27
    public $reports;
28
29
    /**
30
     * @var bool|null
31
     */
32
    public $shouldEndInputHandler;
33
34
    /**
35
     * @var int|null
36
     */
37
    public $maximumInvocations;
38
39
    /**
40
     * @var int|null
41
     */
42
    public $triggerTimeMilliseconds;
43
44
    /**
45
     * @param array       $meets
46
     * @param bool        $shouldEndInputHandler
47
     * @param array       $fails
48
     * @param string|null $reports
49
     * @param int|null    $maximumInvocations
50
     * @param int|null    $triggerTimeMilliseconds
51
     *
52
     * @return Event
53
     */
54
    public static function create(array $meets, bool $shouldEndInputHandler, array $fails = [], string $reports = null, int $maximumInvocations = null, int $triggerTimeMilliseconds = null): self
55
    {
56
        $event = new self();
57
58
        $event->meets                   = $meets;
59
        $event->shouldEndInputHandler   = $shouldEndInputHandler;
60
        $event->fails                   = $fails;
61
        $event->reports                 = $reports;
62
        $event->maximumInvocations      = $maximumInvocations;
63
        $event->triggerTimeMilliseconds = $triggerTimeMilliseconds;
64
65
        return $event;
66
    }
67
}
68