Completed
Pull Request — master (#2)
by graychen
02:51
created

BaiduGeolocation   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getGeolocation() 0 6 1
1
<?php
2
namespace graychen\geolocation;
3
4
use graychen\contracts\GeolocationInterface;
5
use graychen\contracts\Geolocation;
6
7
class BaiduGeolocation extends Geolocation implements GeolocationInterface
8
{
9
10 1
    public function getGeolocation()
11
    {
12 1
        $url="http://api.map.baidu.com/geocoder/v2/?location=".$this->latitude.",".$this->longitude."&output=json&pois=1&ak=".$this->ak;
13 1
        $file_contents=file_get_contents($url);
14 1
        $json_content=json_decode($file_contents, true);
15 1
        return $json_content;
16
    }
17
}
18