BaiduGeolocation::getGeolocation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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 1
    public function getGeolocation()
10
    {
11 1
        $url="http://api.map.baidu.com/geocoder/v2/?location=".$this->latitude.",".$this->longitude."&output=json&pois=1&ak=".$this->ak;
12 1
        $file_contents=file_get_contents($url);
13 1
        $json_content=json_decode($file_contents, true);
14 1
        return $json_content;
15
    }
16
}
17