Alidayu   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __callStatic() 0 8 2
A setConfig() 0 9 2
1
<?php
2
3
namespace Vicens\Alidayu;
4
5
/**
6
 * 阿里大于外观
7
 * @method static Request\Sms sms(string $phone, string $templateId, string $signName, array $smsParam = [], string $extend = '')
8
 * @method static Request\SmsQuery smsQuery(string $phone, int $page = 1, int $pageSize = 10, string $queryDate = null)
9
 * @method static Request\DoubleCall doubleCall(string $callerNum, string $callerShowNum, string $calledNum, string $calledShowNum, string $extend = '')
10
 * @method static Request\SingleCall singleCall(string $calledNum, string $calledShowNum, string $voiceCode, string $extend = '')
11
 * @method static Request\TtsSingleCall ttsSingleCall(string $calledNum, string $calledShowNum, string $ttsCode, array $ttsParams = [], string $extend = '')
12
 * @method static Request\FlowQuery flowQuery(string | null $outId)
13
 * @method static Request\FlowGrade flowGrade(string | null $phoneNum)
14
 * @method static Request\FlowCharge flowCharge(string $phoneNum, string $grade, string $outRechargeId, int $scope = 0, boolean $isProvince = false, string $reason = '')
15
 * @method static Request\FlowChargeProvince flowChargeProvince(string $phoneNum, string $grade, string $outRechargeId, string $reason = '')
16
 * @method static Response send(Request\AbstractRequest $request)
17
 */
18
class Alidayu
19
{
20
21
    /**
22
     * Client实例
23
     * @var Client|null
24
     */
25
    protected static $client = null;
26
27
    /**
28
     * 阿里大于配置
29
     * @var array
30
     */
31
    protected static $config = [];
32
33
34
    /**
35
     * 设置配置
36
     * @param array $config
37
     * @return string
38
     */
39
    public static function setConfig(array $config = [])
40
    {
41
        static::$config = $config;
42
43
        if (!is_null(static::$client)) {
44
            static::$client->setConfig($config);
45
        }
46
47
        return static::class;
48
    }
49
50
51
    /**
52
     * 自动调用Client方法
53
     * @param $name
54
     * @param $arguments
55
     * @return mixed
56
     */
57
    public static function __callStatic($name, $arguments)
58
    {
59
60
        if (is_null(static::$client)) {
61
            static::$client = new Client(static::$config);
62
        }
63
64
        return call_user_func_array([static::$client, $name], $arguments);
65
    }
66
}