GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( b3c16d...bf0a53 )
by Carlos
03:59
created

KingttoGateway::send()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
cc 2
nc 2
nop 3
1
<?php
2
3
/*
4
 * This file is part of the overtrue/easy-sms.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Overtrue\EasySms\Gateways;
13
14
use Overtrue\EasySms\Contracts\MessageInterface;
15
use Overtrue\EasySms\Contracts\PhoneNumberInterface;
16
use Overtrue\EasySms\Exceptions\GatewayErrorException;
17
use Overtrue\EasySms\Support\Config;
18
use Overtrue\EasySms\Traits\HasHttpRequest;
19
20
/**
21
 * Class KingttoGateWay.
22
 *
23
 * @see http://www.kingtto.cn/
24
 */
25
class KingttoGateway extends Gateway
26
{
27
    use HasHttpRequest;
28
29
    const ENDPOINT_URL = 'http://101.201.41.194:9999/sms.aspx';
30
31
    const ENDPOINT_METHOD = 'send';
32
33
    /**
34
     * @param PhoneNumberInterface $to
35
     * @param MessageInterface     $message
36
     * @param Config               $config
37
     *
38
     * @return \Psr\Http\Message\ResponseInterface|array|string
39
     *
40
     * @throws GatewayErrorException
41
     */
42
    public function send(PhoneNumberInterface $to, MessageInterface $message, Config $config)
43
    {
44
        $params = [
45
            'action' => self::ENDPOINT_METHOD,
46
            'userid' => $config->get('userid'),
47
            'account' => $config->get('account'),
48
            'password' => $config->get('password'),
49
            'mobile' => $to->getNumber(),
50
            'content' => $message->getContent(),
51
        ];
52
53
        $result = $this->post(self::ENDPOINT_URL, $params);
54
55
        if ('Success' != $result['returnstatus']) {
56
            throw new GatewayErrorException($result['message'], $result['remainpoint'], $result);
57
        }
58
59
        return $result;
60
    }
61
}
62