Item   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 13
c 1
b 0
f 0
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTransferTypeCn() 0 14 5
1
<?php
2
/**
3
 * This file is part of the mucts.com.
4
 *
5
 * This source file is subject to the MIT license that is bundled
6
 * with this source code in the file LICENSE.
7
 *
8
 * @version 1.0
9
 * @author herry<[email protected]>
10
 * @copyright © 2020  MuCTS.com All Rights Reserved.
11
 */
12
13
namespace MuCTS\Sobot\Robot\RobotChat\Response;
14
15
16
use MuCTS\Sobot\Contracts\Response;
17
use MuCTS\Sobot\Robot\RobotChat\Response\Item\MultiResponseInfo;
18
use MuCTS\Sobot\Robot\RobotChat\Response\Item\Suggestions;
19
20
/**
21
 * Class Item
22
 * @property-read  string $answer 答案
23
 * @property-read  Suggestions[] $suggestions 推荐问题列表,详见下文
24
 * @property-read  string $question 原始问题 词条名称
25
 * @property-read  string $docid 词条id
26
 * @property-read  string $visitorid 用户id
27
 * @property-read  string $cid 会话id
28
 * @property-read  string $msgid 消息体id
29
 * @property-read  string $stripe 问题推荐引导语
30
 * @property-read  string $robot_flag 机器人编号
31
 * @property-read  string $answer_type 机器人回答类型
32
 * @property-read  string $session_new 是否是新会话 true:是,false:不是
33
 * @property-read  int $transfer_type 触发转人工类型 0:不触发,1:重复提问,2:负向情绪,3:命中关键字
34
 * @property-read  string $transfer_type_cn 触发转人工类型
35
 * @property-read  MultiResponseInfo $multi_response_info 多轮会话返回数据
36
 * @package MuCTS\Sobot\Robot\RobotChat\Response
37
 */
38
class Item extends Response
39
{
40
    /**
41
     * 触发转人工类型
42
     * @return string
43
     */
44
    public function getTransferTypeCn()
45
    {
46
        $transferType = intval($this->transfer_type);
47
        switch ($transferType) {
48
            case 0:
49
                return '不触发';
50
            case 1:
51
                return '重复提问';
52
            case 2:
53
                return '负向情绪';
54
            case 3:
55
                return '命中关键字';
56
            default:
57
                return '未知';
58
        }
59
    }
60
}