Conditions | 3 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | protected function synthesize($text, $outFile) |
||
27 | { |
||
28 | $result = false; |
||
29 | $sp = new \TTS\Helper\SplitterText(); |
||
30 | $text = iconv('UTF-8', 'UTF-8', $text); |
||
31 | |||
32 | $lines = $sp->split($text, 512); |
||
33 | $content = ''; |
||
34 | foreach ($lines as $line) { |
||
35 | $query = [ |
||
36 | 'quality' => 'hi', |
||
37 | 'text' => $line, |
||
38 | 'format' => 'mp3', |
||
39 | 'lang' => 'ru_RU', |
||
40 | 'platform' => 'web', |
||
41 | 'application' => 'translate' |
||
42 | ]; |
||
43 | $content .= $this->reguestGet($query); |
||
44 | } |
||
45 | if (strlen($content) > 0) { |
||
46 | $result = true; |
||
47 | file_put_contents($outFile, $content); |
||
48 | } |
||
49 | return $result; |
||
50 | } |
||
51 | |||
57 |