Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | 2 | public function converse($sessionId, $text = null, Context $context = null) |
|
32 | { |
||
33 | $query = [ |
||
34 | 2 | 'session_id' => $sessionId, |
|
35 | 2 | ]; |
|
36 | |||
37 | 2 | if (!empty($text)) { |
|
38 | 2 | $query['q'] = $text; |
|
39 | 2 | } |
|
40 | |||
41 | 2 | $body = null; |
|
42 | |||
43 | // Don't send empty array |
||
44 | 2 | if (null !== $context && !$context->isEmpty()) { |
|
45 | 1 | $body = $context; |
|
46 | 1 | } |
|
47 | |||
48 | 2 | $response = $this->client->send('POST', '/converse', $body, $query); |
|
49 | |||
50 | 2 | return $this->decodeResponse($response); |
|
51 | } |
||
52 | } |
||
53 |