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.
Passed
Push — master ( ce3420...85bd0b )
by Carlos
34s
created

SubmailGateway   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 41
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A send() 0 11 1
A buildEndpoint() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the overtrue/easy-sms.
5
 * (c) overtrue <[email protected]>
6
 * This source file is subject to the MIT license that is bundled
7
 * with this source code in the file LICENSE.
8
 */
9
10
namespace Overtrue\EasySms\Gateways;
11
12
use Overtrue\EasySms\HasHttpRequest;
13
14
/**
15
 * Class SubmailGateway.
16
 */
17
class SubmailGateway extends Gateway
18
{
19
20
    use HasHttpRequest;
21
22
    const ENDPOINT_TEMPLATE = 'https://api.mysubmail.com/message/%s.%s';
23
    const ENDPOINT_FORMAT = 'json';
24
25
    /**
26
     * Send a short message.
27
     *
28
     * @param string|int $to
29
     * @param string     $message
30
     * @param array      $data
31
     *
32
     * @return mixed
33
     */
34
    public function send($to, $message, array $data = [])
35
    {
36
        $endpoint = $this->buildEndpoint('xsend');
37
        return $this->post($endpoint, [
38
            'appid' => $this->config->get('app_id'),
39
            'signature' => $this->config->get('app_key'),
40
            'project' => $this->config->get('project'),
41
            'to' => $to,
42
            'vars' => json_encode($data),
43
        ]);
44
    }
45
46
    /**
47
     * Build endpoint url.
48
     *
49
     * @param string $function
50
     *
51
     * @return string
52
     */
53
    protected function buildEndpoint($function)
54
    {
55
        return sprintf(self::ENDPOINT_TEMPLATE,$function, self::ENDPOINT_FORMAT);
56
    }
57
}