Completed
Push — master ( aef33f...952551 )
by Gallice
51s queued 10s
created

ConverseApi   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 29
rs 10
ccs 9
cts 9
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A converse() 0 11 1
1
<?php
2
3
namespace Tgallice\Wit;
4
5
use Tgallice\Wit\Model\Context;
6
7
class ConverseApi
8
{
9
    use ResponseHandler;
10
11
    /**
12
     * @var Client
13
     */
14
    private $client;
15
16
    /**
17
     * @param Client $client
18
     */
19 4
    public function __construct(Client $client)
20
    {
21 4
        $this->client = $client;
22 4
    }
23
24 1
    public function converse($sessionId, $text, Context $context = null)
25
    {
26
        $query = [
27 1
            'session_id' => $sessionId,
28 1
            'q' => $text,
29 1
        ];
30
31 1
        $response = $this->client->send('POST', '/converse', $context, $query);
32
33 1
        return $this->decodeResponse($response);
34
    }
35
}
36