Request::pushFieldDataValueItem()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 2
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\Tickets\SaveOptionDataValue;
14
15
16
/**
17
 * Class Request
18
 *
19
 * @property-write string $fieldid 工单自定义字段ID
20
 * @property-write array $field_data_value 工单自定义字段选项信息, 格式:[["field_value" => "字段选项值", "field_text" => "字段文本值"]]
21
 * @property-write string $agentid 操作坐席ID
22
 * @property-write string $agent_name 操作坐席名称
23
 *
24
 * @method Request fieldid(string $fieldid) 工单自定义字段ID
25
 * @method Request fieldDataValue(array $fieldDataValue) 工单自定义字段选项信息, 格式:[["field_value" => "字段选项值", "field_text" => "字段文本值"]]
26
 * @method Request agentid(string $agentid) 操作坐席ID
27
 * @method Request agentName(string $agentName) 操作坐席名称
28
 * @package MuCTS\Sobot\Tickets\SaveOptionDataValue
29
 */
30
class Request extends \MuCTS\Sobot\Contracts\Request
31
{
32
    /**
33
     * 追加工单自定义字段选项信息
34
     *
35
     * @param string $fieldValue
36
     * @param string $fieldText
37
     * @return $this
38
     */
39
    public function pushFieldDataValueItem(string $fieldValue, string $fieldText)
40
    {
41
        if (!array_key_exists('field_data_value', $this->param)) {
42
            $this->param['field_data_value'] = [];
43
        }
44
        $this->param['field_data_value'][] = ['field_value' => $fieldValue, 'field_text' => $fieldText];
45
        return $this;
46
    }
47
}