| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | private function request(string $data): string |
||
| 24 | { |
||
| 25 | $filename = uniqid().'.wav'; |
||
| 26 | $filePath = $this->filePath.$filename; |
||
| 27 | // $resource = fopen(realpath($filePath), 'w'); |
||
| 28 | |||
| 29 | $client = new GuzzleHttp\Client(); |
||
| 30 | $client->get($this->url.'?api_key='.urlencode($this->apiKey). |
||
| 31 | '&text='.str_replace('%0A', '+', urlencode($data)), [ |
||
| 32 | 'headers' => [ |
||
| 33 | 'Cache-Control' => 'no-cache', |
||
| 34 | 'Content-Type' => 'audio/wav', |
||
| 35 | ], |
||
| 36 | 'sink' => $filePath, |
||
| 37 | ]); |
||
| 38 | |||
| 39 | return $filename; |
||
| 40 | } |
||
| 42 |