Darksky   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getWeatherData() 0 10 1
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