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

Conversation::converse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 4
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