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 |
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
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @return InitializeOptions |
23
|
|
|
*/ |
24
|
|
|
public function getInitializeOptions() |
25
|
|
|
{ |
26
|
|
|
return $this->initialize; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @param InitializeOptions|array $options |
31
|
|
|
* @return InitializeOptions |
32
|
|
|
*/ |
33
|
|
|
public function initialize($options = []) |
34
|
|
|
{ |
35
|
|
|
if ($options instanceof InitializeOptions) { |
36
|
|
|
$this->initialize = $options; |
37
|
|
|
} elseif (is_array($options)) { |
38
|
|
|
$this->initialize = new InitializeOptions($options); |
39
|
|
|
} else { |
40
|
|
|
$this->initialize = new InitializeOptions(); |
41
|
|
|
} |
42
|
|
|
return $this->initialize; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return mixed |
47
|
|
|
*/ |
48
|
|
|
public function getOutputFormat() |
49
|
|
|
{ |
50
|
|
|
return (string)$this->outputFormat; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param mixed $outputFormat |
55
|
|
|
* @return $this |
56
|
|
|
*/ |
57
|
|
|
public function setOutputFormat($outputFormat) |
58
|
|
|
{ |
59
|
|
|
$this->outputFormat = $outputFormat; |
60
|
|
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @return array |
65
|
|
|
*/ |
66
|
|
|
public function getLexiconNames() |
67
|
|
|
{ |
68
|
|
|
return (array)$this->lexiconNames; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @param array $lexiconNames |
73
|
|
|
* @return $this |
74
|
|
|
*/ |
75
|
|
|
public function setLexiconNames($lexiconNames) |
76
|
|
|
{ |
77
|
|
|
$this->lexiconNames = $lexiconNames; |
78
|
|
|
return $this; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return mixed |
83
|
|
|
*/ |
84
|
|
|
public function getSampleRate() |
85
|
|
|
{ |
86
|
|
|
return (string)$this->sampleRate; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @param mixed $sampleRate |
91
|
|
|
* @return $this |
92
|
|
|
*/ |
93
|
|
|
public function setSampleRate($sampleRate) |
94
|
|
|
{ |
95
|
|
|
$this->sampleRate = $sampleRate; |
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return mixed |
101
|
|
|
*/ |
102
|
|
|
public function getTextType() |
103
|
|
|
{ |
104
|
|
|
return (string)$this->textType; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* @param mixed $textType |
109
|
|
|
* @return $this |
110
|
|
|
*/ |
111
|
|
|
public function setTextType($textType) |
112
|
|
|
{ |
113
|
|
|
$this->textType = $textType; |
114
|
|
|
return $this; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return mixed |
119
|
|
|
*/ |
120
|
|
|
public function getVoiceId() |
121
|
|
|
{ |
122
|
|
|
return (string)$this->voiceId; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param mixed $voiceId |
127
|
|
|
* @return $this |
128
|
|
|
*/ |
129
|
|
|
public function setVoiceId($voiceId) |
130
|
|
|
{ |
131
|
|
|
$this->voiceId = $voiceId; |
132
|
|
|
return $this; |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|