Completed
Push — master ( c7d7d2...b9efc1 )
by Vadim
02:49
created

Polly::setLanguage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace AudioManager\Adapter\Options;
4
5
use AudioManager\Adapter\Polly\InitializeOptions;
6
7
/**
8
 * Class Polly
9
 * @package Adapter\Options
10
 */
11
class Polly extends AbstractOptions implements OptionsInterface
12
{
13
    protected $initialize;
14
15
    protected $outputFormat = 'mp3';
16
    protected $lexiconNames = [];
17
    protected $sampleRate = '16000';
18
    protected $textType = 'text';
19
    protected $voiceId = 'Salli';
20
    protected $language = 'en-US';
21
22
    /**
23
     * @return InitializeOptions
24
     */
25
    public function getInitializeOptions()
26
    {
27
        return $this->initialize;
28
    }
29
30
    /**
31
     * @param InitializeOptions|array $options
32
     * @return InitializeOptions
33
     */
34
    public function initialize($options = [])
35
    {
36
        if ($options instanceof InitializeOptions) {
37
            $this->initialize = $options;
38
        } elseif (is_array($options)) {
39
            $this->initialize = new InitializeOptions($options);
40
        } else {
41
            $this->initialize = new InitializeOptions();
42
        }
43
        return $this->initialize;
44
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49
    public function setLanguage($language)
50
    {
51
        $this->language = $language;
52
        return $this;
53
    }
54
55
    /**
56
     * @inheritdoc
57
     */
58
    public function getLanguage()
59
    {
60
        return $this->language;
61
    }
62
63
    /**
64
     * @inheritdoc
65
     */
66
    public function setVoice($voice)
67
    {
68
        return $this->setVoiceId($voice);
69
    }
70
71
    /**
72
     * @inheritdoc
73
     */
74
    public function getVoice()
75
    {
76
        return $this->getVoiceId();
77
    }
78
79
    /**
80
     * @return mixed
81
     */
82
    public function getOutputFormat()
83
    {
84
        return (string)$this->outputFormat;
85
    }
86
87
    /**
88
     * @param mixed $outputFormat
89
     * @return $this
90
     */
91
    public function setOutputFormat($outputFormat)
92
    {
93
        $this->outputFormat = $outputFormat;
94
        return $this;
95
    }
96
97
    /**
98
     * @return array
99
     */
100
    public function getLexiconNames()
101
    {
102
        return (array)$this->lexiconNames;
103
    }
104
105
    /**
106
     * @param array $lexiconNames
107
     * @return $this
108
     */
109
    public function setLexiconNames($lexiconNames)
110
    {
111
        $this->lexiconNames = $lexiconNames;
112
        return $this;
113
    }
114
115
    /**
116
     * @return mixed
117
     */
118
    public function getSampleRate()
119
    {
120
        return (string)$this->sampleRate;
121
    }
122
123
    /**
124
     * @param mixed $sampleRate
125
     * @return $this
126
     */
127
    public function setSampleRate($sampleRate)
128
    {
129
        $this->sampleRate = $sampleRate;
130
        return $this;
131
    }
132
133
    /**
134
     * @return mixed
135
     */
136
    public function getTextType()
137
    {
138
        return (string)$this->textType;
139
    }
140
141
    /**
142
     * @param mixed $textType
143
     * @return $this
144
     */
145
    public function setTextType($textType)
146
    {
147
        $this->textType = $textType;
148
        return $this;
149
    }
150
151
    /**
152
     * @return mixed
153
     */
154
    public function getVoiceId()
155
    {
156
        return (string)$this->voiceId;
157
    }
158
159
    /**
160
     * @param mixed $voiceId
161
     * @return $this
162
     */
163
    public function setVoiceId($voiceId)
164
    {
165
        $this->voiceId = $voiceId;
166
        return $this;
167
    }
168
}
169