Completed
Push — master ( f14797...200867 )
by Alex
06:41 queued 04:56
created

Home   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 37
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getContainer() 0 4 1
A hello() 0 6 1
1
<?php
2
/**
3
 *
4
 */
5
6
namespace App\Controller;
7
8
use Interop\Container\ContainerInterface;
9
use Slim\Http\Request;
10
use Slim\Http\Response;
11
12
class Home
13
{
14
    /**
15
     * @var ContainerInterface
16
     */
17
    protected $ci;
18
19
    /**
20
     * Home constructor.
21
     * @param ContainerInterface $ci
22
     */
23 1
    public function __construct(ContainerInterface $ci)
24
    {
25 1
        $this->ci = $ci;
26 1
    }
27
28
    /**
29
     * @return ContainerInterface
30
     */
31
    public function getContainer()
32
    {
33
        return $this->ci;
34
    }
35
36
    /**
37
     * @param Request $request
38
     * @param Response $response
39
     * @return Response
40
     */
41 1
    public function hello(Request $request, Response $response)
42
    {
43 1
        $string = $request->getParam('string');
44
45 1
        return $response->withJson(['result' => "Hello {$string}"], 200);
46
    }
47
48
}
49