1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AudioManager\Adapter\Options; |
4
|
|
|
|
5
|
|
|
use AudioManager\Adapter\Ivona\Authenticate; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class Ivona |
9
|
|
|
* @package AudioManager\Adapter\Options |
10
|
|
|
*/ |
11
|
|
|
class Ivona extends AbstractOptions |
12
|
|
|
{ |
13
|
|
|
|
14
|
|
|
const DEFAULT_USERAGENT = 'TestClient 1.0'; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
protected $userAgent; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Secret key for authenticate |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
protected $secretKey; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Access key for authenticate |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
protected $accessKey; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var Authenticate |
35
|
|
|
*/ |
36
|
|
|
protected $authenticate; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $language = 'en-US'; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $voice = 'Salli'; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected $outputFormatCodec = 'MP3'; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var string |
55
|
|
|
*/ |
56
|
|
|
protected $outputSampleRate = '22050'; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var string |
60
|
|
|
*/ |
61
|
|
|
protected $parametersRate = 'slow'; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Set user agent |
65
|
|
|
* @param $value |
66
|
|
|
* @return $this |
67
|
|
|
*/ |
68
|
1 |
|
public function setUserAgent($value) |
69
|
|
|
{ |
70
|
1 |
|
$this->userAgent = $value; |
71
|
1 |
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get user agent |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
1 |
|
public function getUserAgent() |
79
|
|
|
{ |
80
|
1 |
|
if (empty($this->userAgent)) { |
81
|
1 |
|
$this->userAgent = self::DEFAULT_USERAGENT; |
82
|
1 |
|
} |
83
|
1 |
|
return $this->userAgent; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
2 |
|
public function getSecretKey() |
90
|
|
|
{ |
91
|
2 |
|
return $this->secretKey; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string $secretKey |
96
|
|
|
*/ |
97
|
1 |
|
public function setSecretKey($secretKey) |
98
|
|
|
{ |
99
|
1 |
|
$this->secretKey = $secretKey; |
100
|
1 |
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
2 |
|
public function getAccessKey() |
106
|
|
|
{ |
107
|
2 |
|
return $this->accessKey; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param string $accessKey |
112
|
|
|
*/ |
113
|
1 |
|
public function setAccessKey($accessKey) |
114
|
|
|
{ |
115
|
1 |
|
$this->accessKey = $accessKey; |
116
|
1 |
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Get authenticate object |
120
|
|
|
* @return Authenticate |
121
|
|
|
*/ |
122
|
1 |
|
public function getAuthenticate() |
123
|
|
|
{ |
124
|
1 |
|
if ($this->authenticate === null) { |
125
|
1 |
|
$this->authenticate = new Authenticate($this->getSecretKey(), $this->getAccessKey()); |
126
|
1 |
|
} |
127
|
1 |
|
return $this->authenticate; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return string |
132
|
|
|
*/ |
133
|
|
|
public function getLanguage() |
134
|
|
|
{ |
135
|
|
|
return $this->language; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @param string $language |
140
|
|
|
*/ |
141
|
|
|
public function setLanguage($language) |
142
|
|
|
{ |
143
|
|
|
$this->language = $language; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function getVoice() |
150
|
|
|
{ |
151
|
|
|
return $this->voice; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param string $voice |
156
|
|
|
*/ |
157
|
|
|
public function setVoice($voice) |
158
|
|
|
{ |
159
|
|
|
$this->voice = $voice; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @return string |
164
|
|
|
*/ |
165
|
|
|
public function getOutputFormatCodec() |
166
|
|
|
{ |
167
|
|
|
return $this->outputFormatCodec; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* @param string $outputFormatCodec |
172
|
|
|
*/ |
173
|
|
|
public function setOutputFormatCodec($outputFormatCodec) |
174
|
|
|
{ |
175
|
|
|
$this->outputFormatCodec = $outputFormatCodec; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* @return string |
180
|
|
|
*/ |
181
|
|
|
public function getOutputSampleRate() |
182
|
|
|
{ |
183
|
|
|
return $this->outputSampleRate; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @param string $outputSampleRate |
188
|
|
|
*/ |
189
|
|
|
public function setOutputSampleRate($outputSampleRate) |
190
|
|
|
{ |
191
|
|
|
$this->outputSampleRate = $outputSampleRate; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @return string |
196
|
|
|
*/ |
197
|
|
|
public function getParametersRate() |
198
|
|
|
{ |
199
|
|
|
return $this->parametersRate; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* @param string $parametersRate |
204
|
|
|
*/ |
205
|
|
|
public function setParametersRate($parametersRate) |
206
|
|
|
{ |
207
|
|
|
$this->parametersRate = $parametersRate; |
208
|
|
|
} |
209
|
|
|
} |
210
|
|
|
|