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
Branch dev (222007)
by t
06:48 queued 03:54
created

Ip   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 19
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetchAttribution() 0 10 2
1
<?php
2
/**
3
 * Class Ip
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\ihelpers\Arrays;
12
use icy2003\php\ihelpers\Http;
13
use icy2003\php\ihelpers\Json;
14
15
/**
16
 * Ip 相关接口
17
 */
18
class Ip extends Api
19
{
20
    /**
21
     * 查询 Ip 归属地
22
     *
23
     * @param string $address IP 地址
24
     *
25
     * @return void
26
     */
27
    public function fetchAttribution($address)
28
    {
29
        $res = Http::get('https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php', [
30
            'query' => $address,
31
            'resource_id' => '6006',
32
            'oe' => 'utf8',
33
        ]);
34
        $data = Json::get($res, 'data.0.location', false);
35
        if (is_string($data)) {
36
            list($this->_result['city'], $this->_result['type']) = Arrays::lists(explode(' ', $data), 2);
37
        }
38
    }
39
}
40