OutputSpeech::createByText()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MaxBeckers\AmazonAlexa\Response;
6
7
class OutputSpeech
8
{
9
    public const TYPE_PLAINTEXT = 'PlainText';
10
    public const TYPE_SSML = 'SSML';
11
12 7
    public function __construct(
13
        public string $type = self::TYPE_PLAINTEXT,
14
        public ?string $text = null,
15
        public ?string $ssml = null
16
    ) {
17 7
    }
18
19 3
    public static function createByText(string $text): self
20
    {
21 3
        return new self(text: $text);
22
    }
23
24 3
    public static function createBySsml(string $ssml): self
25
    {
26 3
        return new self(self::TYPE_SSML, ssml: $ssml);
27
    }
28
}
29