TtsSingleCall   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 44
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A getParams() 0 9 2
A __construct() 0 8 1
1
<?php
2
3
namespace Vicens\Alidayu\Request;
4
5
/**
6
 * 文本转语音通知
7
 * @link https://api.alidayu.com/docs/api.htm?apiId=25444
8
 * @method $this|string calledNum(string | null $calledNum = null)
9
 * @method $this|string calledShowNum(string | null $calledShowNum = null)
10
 * @method $this|string ttsCode(string | null $ttsCode = null)
11
 * @method $this|array ttsParam(array | null $ttsParam = null)
12
 * @method $this|string extend(string | null $extend = null)
13
 */
14
class TtsSingleCall extends AbstractRequest
15
{
16
17
    /**
18
     * TtsSingleCall constructor.
19
     * @param string $calledNum 被叫号码
20
     * @param string $calledShowNum 被叫号码侧的号码显示
21
     * @param string $ttsCode 模板ID
22
     * @param array $ttsParam 模板变量
23
     * @param string $extend 回传参数
24
     */
25
    public function __construct($calledNum, $calledShowNum, $ttsCode, array $ttsParam = [], $extend = '')
26
    {
27
        $this->setParams([
28
            'called_num' => $calledNum,
29
            'called_show_num' => $calledShowNum,
30
            'tts_code' => $ttsCode,
31
            'tts_param' => $ttsParam,
32
            'extend' => $extend
33
        ]);
34
    }
35
36
    /**
37
     * 返回接口参数
38
     * @return array
39
     */
40
    public function getParams()
41
    {
42
        $params = parent::getParams();
43
44
        if (is_array($params['tts_param'])) {
45
            $params['tts_param'] = json_encode($params['tts_param']);
46
        }
47
48
        return $params;
49
    }
50
51
    /**
52
     * 返回接口名
53
     * @return string
54
     */
55
    public function getMethod()
56
    {
57
        return 'alibaba.aliqin.fc.tts.num.singlecall';
58
    }
59
}