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

RecognizerMatch   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 18
dl 0
loc 53
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 12 1
1
<?php
2
3
namespace MaxBeckers\AmazonAlexa\Response\Directives\GameEngine;
4
5
/**
6
 * @author Maximilian Beckers <[email protected]>
7
 */
8
class RecognizerMatch extends Recognizer
9
{
10
    const TYPE            = 'match';
11
    const ANCHOR_START    = 'start';
12
    const ANCHOR_END      = 'end';
13
    const ANCHOR_ANYWHERE = 'anywhere';
14
15
    /**
16
     * @var string|null
17
     */
18
    public $anchor;
19
20
    /**
21
     * @var bool|null
22
     */
23
    public $fuzzy;
24
25
    /**
26
     * @var array
27
     */
28
    public $gadgetIds = [];
29
30
    /**
31
     * @var array
32
     */
33
    public $actions = [];
34
35
    /**
36
     * @var Pattern[]
37
     */
38
    public $pattern = [];
39
40
    /**
41
     * @param string    $anchor
42
     * @param bool      $fuzzy
43
     * @param array     $gadgetIds
44
     * @param array     $actions
45
     * @param Pattern[] $pattern
46
     *
47
     * @return RecognizerMatch
48
     */
49
    public static function create(string $anchor, bool $fuzzy, array $gadgetIds = [], array $actions = [], array $pattern = []): self
50
    {
51
        $recognizer = new self();
52
53
        $recognizer->type      = self::TYPE;
54
        $recognizer->anchor    = $anchor;
55
        $recognizer->fuzzy     = $fuzzy;
56
        $recognizer->gadgetIds = $gadgetIds;
57
        $recognizer->actions   = $actions;
58
        $recognizer->pattern   = $pattern;
59
60
        return $recognizer;
61
    }
62
}
63