MockApi::ipActionGet()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
nc 1
nop 0
dl 0
loc 8
c 1
b 0
f 0
cc 1
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Blixter\Mock;
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
 * A sample controller to show how a controller class can be implemented.
14
 * The controller will be injected with $di if implementing the interface
15
 * ContainerInjectableInterface, like this sample class does.
16
 * The controller is mounted on a particular route and can then handle all
17
 * requests for that mount point.
18
 *
19
 * @SuppressWarnings(PHPMD.TooManyPublicMethods)
20
 */
21
class MockApi implements ContainerInjectableInterface
22
{
23
    use ContainerInjectableTrait;
24
25
    /**
26
     * This is the index method action, it handles:
27
     * GET METHOD mountpoint
28
     * GET METHOD mountpoint/
29
     * GET METHOD mountpoint/index
30
     *
31
     * @return Array
32
     */
33 1
    public function indexActionGet(): array
34
    {
35 1
        $weatherMock = new WeatherMock();
36
37 1
        $res = $weatherMock->getWeatherUpcoming();
38
39
        // Deal with the action and return a response.
40 1
        return $res;
41
    }
42
43
    /**
44
     * This is the index method action, it handles:
45
     * GET METHOD mountpoint/past
46
     *
47
     * @return Array
48
     */
49 1
    public function pastActionGet(): array
50
    {
51 1
        $weatherMock = new WeatherMock();
52
53 1
        $res = $weatherMock->getWeatherPast();
54
55
        // Deal with the action and return a response.
56 1
        return $res;
57
    }
58
59
    /**
60
     * This is the index method action, it handles:
61
     * GET METHOD mountpoint/past
62
     *
63
     * @return Array
64
     */
65 1
    public function ipActionGet(): array
66
    {
67 1
        $ipMock = new IpMock();
68
69 1
        $res = $ipMock->getIpInfo();
70
71
        // Deal with the action and return a response.
72 1
        return $res;
73
    }
74
}
75