RecognizerMatch   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 18
dl 0
loc 53
ccs 9
cts 9
cp 1
rs 10
c 1
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|null
27
     */
28
    public $gadgetIds;
29
30
    /**
31
     * @var array|null
32
     */
33
    public $actions;
34
35
    /**
36
     * @var Pattern[]
37
     */
38
    public $pattern = [];
39
40
    /**
41
     * @param Pattern[]  $pattern
42
     * @param string     $anchor
43
     * @param bool       $fuzzy
44
     * @param array|null $gadgetIds
45
     * @param array|null $actions
46
     *
47
     * @return RecognizerMatch
48
     */
49 1
    public static function create(array $pattern, string $anchor = self::ANCHOR_START, bool $fuzzy = false, $gadgetIds = null, $actions = null): self
50
    {
51 1
        $recognizer = new self();
52
53 1
        $recognizer->type      = self::TYPE;
54 1
        $recognizer->anchor    = $anchor;
55 1
        $recognizer->fuzzy     = $fuzzy;
56 1
        $recognizer->gadgetIds = $gadgetIds;
57 1
        $recognizer->actions   = $actions;
58 1
        $recognizer->pattern   = $pattern;
59
60 1
        return $recognizer;
61
    }
62
}
63