1 | <?php |
||
12 | class PollyConverter implements Converter |
||
13 | { |
||
14 | use Storable, Sourceable; |
||
15 | |||
16 | /** |
||
17 | * Client instance of Polly. |
||
18 | * |
||
19 | * @var \Aws\Polly\PollyClient |
||
20 | */ |
||
21 | protected $client; |
||
22 | |||
23 | /** |
||
24 | * Construct converter. |
||
25 | * |
||
26 | * @param PollyClient $client |
||
27 | */ |
||
28 | public function __construct(PollyClient $client) |
||
32 | |||
33 | /** |
||
34 | * Get the Polly Client. |
||
35 | * |
||
36 | * @return \Aws\Polly\PollyClient |
||
37 | */ |
||
38 | public function getClient(): PollyClient |
||
42 | |||
43 | /** |
||
44 | * Converts the text to speech. |
||
45 | * |
||
46 | * @param string $data |
||
47 | * @param array $options |
||
48 | * @return string |
||
49 | */ |
||
50 | public function convert(string $data, array $options = null) |
||
76 | |||
77 | /** |
||
78 | * Request to Amazon Polly to synthesize speech. |
||
79 | * |
||
80 | * @param string|array $text |
||
81 | * @param array $options |
||
82 | * @return array|\Aws\Result; |
||
|
|||
83 | */ |
||
84 | protected function synthesizeSpeech($text, array $options = null) |
||
111 | |||
112 | /** |
||
113 | * Merges the output from amazon polly |
||
114 | * |
||
115 | * @return mixed |
||
116 | */ |
||
117 | protected function mergeOutputs(array $results) |
||
127 | |||
128 | /** |
||
129 | * Checks the length of the text if more than 3000 |
||
130 | * |
||
131 | * @param string $text |
||
132 | * @return boolean |
||
133 | */ |
||
134 | protected function isTextAboveLimit(string $text) |
||
138 | |||
139 | /** |
||
140 | * Chunk the given text into array |
||
141 | * |
||
142 | * @param string $text |
||
143 | * @param int $size |
||
144 | * @return array |
||
145 | */ |
||
146 | protected function getChunkText(string $text, int $size = 2000) |
||
150 | |||
151 | /** |
||
152 | * Get the text to speech voice ID. |
||
153 | * |
||
154 | * @param array $options |
||
155 | * @return string |
||
156 | */ |
||
157 | protected function voice($options) |
||
163 | |||
164 | /** |
||
165 | * Get the audio format. |
||
166 | * |
||
167 | * @param array $options |
||
168 | * @return string |
||
169 | */ |
||
170 | protected function format($options) |
||
176 | |||
177 | /** |
||
178 | * Get the content of the result from AWS Polly. |
||
179 | * |
||
180 | * @param mixed $result |
||
181 | * @return mixed |
||
182 | */ |
||
183 | protected function getResultContent($result) |
||
187 | } |
||
188 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.