Item   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 19
eloc 47
c 1
b 0
f 0
dl 0
loc 83
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAnswerFlagCn() 0 14 5
A getMatchFlagCn() 0 14 5
A getUsedFlagCn() 0 14 5
A getAuditStatusCn() 0 12 4
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\QueryDocDetail\Response;
14
15
16
use MuCTS\Sobot\Contracts\Response;
17
use MuCTS\Sobot\Robot\QueryDocDetail\Response\Item\LinkQuestionList;
18
19
/**
20
 * Class Item
21
 * @property-read string $answer_desc 知识库配置的答案内容,格式为HTML
22
 * @property-read int $answer_flag 答案类型:1文本,2图片,3图文,4视频
23
 * @property-read string $answer_flag_cn 答案类型
24
 * @property-read string $answerid 答案ID
25
 * @property-read string $answer_img 图文类型的缩略图
26
 * @property-read string $answer_txt 答案纯文本信息
27
 * @property-read string $answer_summary 图文类型摘要
28
 * @property-read int $audit_status 审核状态:0待审核,1永久有效,2指定时间有效
29
 * @property-read string $audit_status_cn 审核状态
30
 * @property-read string $companyid 公司id
31
 * @property-read string $docid 词条ID
32
 * @property-read string $create_time 创建时间
33
 * @property-read string $effect_time 生效时间
34
 * @property-read LinkQuestionList[] $link_question_list 关联问题列表,详见下文
35
 * @property-read string $link_question_num 关联问题个数
36
 * @property-read string $linked_flag 是否被其他问题关联,1是,0无
37
 * @property-read int $match_flag 匹配模式:0智能匹配,1完全匹配,2包含匹配,3欢迎语匹配
38
 * @property-read string $match_flag_cn 匹配模式
39
 * @property-read string $questionid 问题ID
40
 * @property-read string $question_title 问题标题
41
 * @property-read string $question_typeid 问题类型ID
42
 * @property-read string $question_type_name 问题类型名
43
 * @property-read int $robot_flag 知识库所属机器人:0公共知识库,1机器人一
44
 * @property-read string $smail_question_num 相似问法个数
45
 * @property-read string $updateid 更新人ID
46
 * @property-read string $update_time 更新时间
47
 * @property-read int $used_flag 词条状态,0启用,1手动停用,2系统停用,3过期停用
48
 * @property-read string $used_flag_cn 词条状态
49
 * @package MuCTS\Sobot\Robot\QueryDocDetail\Response
50
 */
51
class Item extends Response
52
{
53
    /**
54
     * 答案类型
55
     *
56
     * @return string
57
     */
58
    public function getAnswerFlagCn()
59
    {
60
        $answerFlag = intval($this->answer_flag);
61
        switch ($answerFlag) {
62
            case 1 :
63
                return '文本';
64
            case 2:
65
                return '图片';
66
            case 3:
67
                return '图文';
68
            case 4:
69
                return '视频';
70
            default:
71
                return '未知';
72
        }
73
    }
74
75
    /**
76
     * 审核状态
77
     * @return string
78
     */
79
    public function getAuditStatusCn()
80
    {
81
        $auditStatus = intval($this->audit_status);
82
        switch ($auditStatus) {
83
            case 0:
84
                return '待审核';
85
            case 1:
86
                return '永久有效';
87
            case 2:
88
                return '指定时间有效';
89
            default:
90
                return '未知';
91
        }
92
    }
93
94
    /**
95
     * 匹配模式
96
     * @return string
97
     */
98
    public function getMatchFlagCn()
99
    {
100
        $matchFlag = intval($this->match_flag);
101
        switch ($matchFlag) {
102
            case 0:
103
                return '智能匹配';
104
            case 1:
105
                return '完全匹配';
106
            case 2:
107
                return '包含匹配';
108
            case 3:
109
                return '欢迎语匹配';
110
            default:
111
                return '未知';
112
        }
113
    }
114
115
    /**
116
     * 词条状态
117
     *
118
     * @return string
119
     */
120
    public function getUsedFlagCn()
121
    {
122
        $usedFlag = intval($this->used_flag);
123
        switch ($usedFlag) {
124
            case 0:
125
                return '启用';
126
            case 1:
127
                return '手动停用';
128
            case 2:
129
                return '系统停用';
130
            case 3:
131
                return '过期停用';
132
            default:
133
                return '未知';
134
        }
135
    }
136
}