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:07
created

Ip   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetchAttribution() 0 12 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 static
26
     */
27
    public function fetchAttribution($address)
28
    {
29
        $data = Json::get(Http::get('https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php', [
30
            'query' => $address,
31
            'resource_id' => '6006',
32
            'oe' => 'utf8',
33
        ]), 'data.0.location', false);
34
        if (is_string($data)) {
35
            list($this->_result['city'], $this->_result['type']) = Arrays::lists(explode(' ', $data), 2);
36
        }
37
38
        return $this;
39
    }
40
}
41