Item   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
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 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getUstatusCn() 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\RobotFeedback\Response;
14
15
16
use MuCTS\Sobot\Contracts\Response;
17
18
/**
19
 * Class Item
20
 * @property-read int $ustatus 用户状态 -2:排队,-1:机器人,0:离线,1-在线
21
 * @property-read string $ustatus_cn 用户状态
22
 * @package MuCTS\Sobot\Robot\RobotFeedback\Response
23
 */
24
class Item extends Response
25
{
26
    /**
27
     * 用户状态
28
     *
29
     * @return string
30
     */
31
    public function getUstatusCn()
32
    {
33
        $ustatus = intval($this->ustatus);
34
        switch ($ustatus) {
35
            case -2:
36
                return '排队';
37
            case -1:
38
                return '机器人';
39
            case 0:
40
                return '离线';
41
            case 1:
42
                return '在线';
43
            default:
44
                return '未知';
45
        }
46
    }
47
}