Conditions | 6 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 3 | public function extractMeaning($file, Context $context = null, array $queryParams = []) |
|
32 | { |
||
33 | 3 | if (!$file || (!is_resource($file) && !is_readable($file))) { |
|
34 | 1 | throw new \InvalidArgumentException('$file argument must be a readable file path or a valid resource'); |
|
35 | } |
||
36 | |||
37 | 2 | if (null !== $context) { |
|
38 | 2 | $queryParams['context'] = json_encode($context); |
|
39 | 2 | } |
|
40 | |||
41 | 2 | $file = is_resource($file) ? $file : fopen($file, 'r'); |
|
42 | 2 | $response = $this->client->send('POST', '/speech', $file, $queryParams); |
|
43 | |||
44 | 2 | return $this->decodeResponse($response); |
|
45 | } |
||
46 | } |
||
47 |