PlayDirective   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A __construct() 0 5 1
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