Darksky::getWeatherData()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
namespace Anax\DI;
3
4
use Anax\Commons\ContainerInjectableInterface;
5
use Anax\Commons\ContainerInjectableTrait;
6
7
class Darksky implements ContainerInjectableInterface
8
{
9
    use ContainerInjectableTrait;
10
11
    public $apiKey;
12
13 4
    public function __construct($apiKey)
14
    {
15 4
        $this->apiKey = $apiKey;
16 4
    }
17
18 4
    public function getWeatherData($longitude, $latitude)
19
    {
20 4
        $url = 'https://api.darksky.net/forecast';
21 4
        $question = [$this->apiKey . '/' . $latitude . ',' . $longitude . '?lang=sv&units=auto'];
22
        
23 4
        $curl = $this->di->get("curl");
24
25 4
        $weatherJSON = $curl->multiCurl($url, $question);
26
27 4
        return $weatherJSON;
28
    }
29
}
30