indexs   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 15 1
1
<?php
2
3
namespace Moody\weather_and_position;
4
5
use Anax\Commons\ContainerInjectableInterface;
6
use Anax\Commons\ContainerInjectableTrait;
7
8
// use Anax\Route\Exception\ForbiddenException;
9
// use Anax\Route\Exception\NotFoundException;
10
// use Anax\Route\Exception\InternalErrorException;
11
12
13
14
/**
15
 * A sample controller to show how a controller class can be implemented.
16
 * The controller will be injected with $di if implementing the interface
17
 * ContainerInjectableInterface, like this sample class does.
18
 * The controller is mounted on a particular route and can then handle all
19
 * requests for that mount point.
20
 *
21
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
22
 */
23
class indexs implements ContainerInjectableInterface
24
{
25
    use ContainerInjectableTrait;
26
27
    protected $ipAddress;
28
    protected $object;
29
30
31 1
    public function indexAction() : object
32
    {
33 1
        $host = null;
0 ignored issues
show
Unused Code introduced by
The assignment to $host is dead and can be removed.
Loading history...
34 1
        $title = "Ip validator";
35 1
        $page = $this->di->get("page");
36 1
        $request = $this->di->get("request");
0 ignored issues
show
Unused Code introduced by
The assignment to $request is dead and can be removed.
Loading history...
37 1
        $this->object = new IpValidate();
38
39 1
        $this->openWeatherMapModel = $this->di->get("openWeatherMap");
0 ignored issues
show
Bug Best Practice introduced by
The property openWeatherMapModel does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
40 1
        $host = $this->object->getDomain($this->ipAddress);
41 1
        $data["host"] = $host;
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
42
43 1
        $page->add("weather/index", $data);
44 1
        return $page->render([
45 1
            "title" => $title,
46
        ]);
47
    }
48
}
49