PlayDirective::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response\Directives\AudioPlayer;
6
7
use MaxBeckers\AmazonAlexa\Response\Directives\Directive;
8
9
class PlayDirective extends Directive
10
{
11
    public const TYPE = 'AudioPlayer.Play';
12
13
    public const PLAY_BEHAVIOR_REPLACE_ALL = 'REPLACE_ALL';
14
    public const PLAY_BEHAVIOR_ENQUEUE = 'ENQUEUE';
15
    public const PLAY_BEHAVIOR_REPLACE_ENQUEUED = 'REPLACE_ENQUEUED';
16
17 2
    public function __construct(
18
        public ?string $playBehavior = null,
19
        public ?AudioItem $audioItem = null
20
    ) {
21 2
        parent::__construct(self::TYPE);
22
    }
23
24 2
    public static function create(AudioItem $audioItem, string $playBehavior = self::PLAY_BEHAVIOR_REPLACE_ALL): self
25
    {
26 2
        return new self($playBehavior, $audioItem);
27
    }
28
}
29