Passed
Push — master ( d35de3...0beac9 )
by Patrik
02:12
created

WeatherJsonController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 25
ccs 10
cts 10
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexActionGet() 0 15 1
1
<?php
2
3
namespace Anax\Controller;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
class WeatherJsonController implements ContainerInjectableInterface
9
{
10
11
    use ContainerInjectableTrait;
12
13
    /**
14
     * Request get and setup json array.
15
     * @method indexAction
16
     * @return array
17
     */
18 1
    public function indexActionGet() : array
19
    {
20 1
        $title = "Weather";
21 1
        $location = htmlentities($this->di->get("request")->getGet("location"));
22 1
        $weather = $this->di->get("weather");
23
        
24
        $json = [
25 1
            "title" => $title,
26 1
            "location" => $location,
27 1
            "geocode" => $weather->loadGeolocation($location),
28 1
            "weather" => $weather->loadWeather(),
29 1
            "historic" => $weather->multiCurl()
30
        ];
31
32 1
        return [$json];
33
    }
34
}
35