Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3.009 |
Changes | 0 |
1 | <?php |
||
18 | 6 | public function analyze($text, array $params = []) |
|
19 | { |
||
20 | 6 | $headers = ['Content-Type' => 'application/json']; |
|
21 | |||
22 | 6 | if (!isset($params['version'])) { |
|
23 | 6 | $params['version'] = \date('Y-m-d'); |
|
24 | 2 | } |
|
25 | |||
26 | 6 | $response = $this->postRaw('/api/v3/tone_chat' . '?' . http_build_query($params), $text, $headers); |
|
27 | |||
28 | 6 | if ($response->getStatusCode() !== 200) { |
|
29 | 3 | $this->handleErrors($response); |
|
30 | } |
||
31 | |||
32 | 3 | return $this->hydrator->hydrate($response, UtteranceAnalyses::class); |
|
33 | } |
||
34 | } |
||
35 |