Conversation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 28
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A converse() 0 4 1
1
<?php
2
3
namespace Tgallice\Wit\Api;
4
5
use Tgallice\Wit\ActionMapping;
6
use Tgallice\Wit\Api;
7
use Tgallice\Wit\Conversation as ConversationDelegate;
8
use Tgallice\Wit\ConverseApi;
9
use Tgallice\Wit\Model\Context;
10
use Tgallice\Wit\Model\Step;
11
12
/**
13
 * @deprecated This class is deprecated as of 0.1 and will be removed in 1.0.
14
 */
15
class Conversation
16
{
17
    const MAX_STEPS_ITERATION = 5;
18
19
    /**
20
     * @var ConversationDelegate
21
     */
22
    private $conversation;
23
24
    public function __construct(Api $api, ActionMapping $actionMapping)
25
    {
26
        $converseApi = new ConverseApi($api->getClient());
27
        $this->conversation = new ConversationDelegate($converseApi, $actionMapping);
28
    }
29
30
    /**
31
     * @param string $sessionId
32
     * @param string|null $message
33
     * @param Context|null $context
34
     * @param int $stepIteration
35
     *
36
     * @return Context The new Context
37
     */
38
    public function converse($sessionId, $message = null, Context $context = null, $stepIteration = self::MAX_STEPS_ITERATION)
39
    {
40
        return $this->conversation->converse($sessionId, $message, $context, $stepIteration);
41
    }
42
}
43