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
Pull Request — master (#23)
by t
03:08
created

Mobile::fetchAttribution()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 11
c 2
b 0
f 0
nc 2
nop 1
dl 0
loc 17
rs 9.9
1
<?php
2
/**
3
 * Class Mobile
4
 *
5
 * @link https://www.icy2003.com/
6
 * @author icy2003 <[email protected]>
7
 * @copyright Copyright (c) 2017, icy2003
8
 */
9
namespace icy2003\php\iapis;
10
11
use icy2003\php\I;
12
use icy2003\php\ihelpers\Http;
13
use icy2003\php\ihelpers\Json;
14
15
/**
16
 * 手机号相关接口
17
 */
18
class Mobile extends Api
19
{
20
    /**
21
     * 查询手机归属地
22
     *
23
     * @param string $number 手机号码
24
     *
25
     * @return static
26
     */
27
    public function fetchAttribution($number)
28
    {
29
        $res = Http::get('https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php', [
30
            'resource_name' => 'guishudi',
31
            'query' => $number,
32
            'oe' => 'utf8',
33
        ]);
34
        $data = Json::get($res, 'data.0', []);
35
        if (!empty($data)) {
36
            $this->_result = [
37
                'city' => I::get($data, 'city'),
38
                'province' => I::get($data, 'prov'),
39
                'type' => I::get($data, 'type'),
40
            ];
41
        }
42
43
        return $this;
44
    }
45
}
46