Passed
Push — master ( fd08ce...6743ff )
by Maximilian
01:01 queued 10s
created

Replace::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace MaxBeckers\AmazonAlexa\Response\Directives\Dialog\UpdateDynamicEntities;
4
5
use MaxBeckers\AmazonAlexa\Response\Directives\Dialog\Entity\Type;
6
7
class Replace extends UpdateDynamicEntities
8
{
9
    const UPDATE_BEHAVIOR = 'REPLACE';
10
11
    /**
12
     * @var array | null
13
     */
14
    public $types;
15
16
    /**
17
     * @param Type $type
18
     */
19
    public function addType(Type $type)
20
    {
21
        $this->types[] = $type;
22
    }
23
24
    /**
25
     * @return Replace
26
     */
27
    public static function create(): self
28
    {
29
        $directive = new static();
30
31
        $directive->type           = self::TYPE;
32
        $directive->types          = [];
33
        $directive->updateBehavior = static::UPDATE_BEHAVIOR;
34
35
        return $directive;
36
    }
37
}
38