WeatherJsonController::indexActionGet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 15
ccs 10
cts 10
cp 1
crap 1
rs 9.9332
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