WeatherController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 28
ccs 0
cts 13
cp 0
rs 10
wmc 1

1 Method

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