Settings::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace APP\Controllers;
6
7
use Psr\Http\Message\ResponseInterface as Response;
8
use Psr\Http\Message\ServerRequestInterface as Request;
9
10
class Settings
11
{
12
    public function __construct($container)
13
    {
14
        $this->container = $container;
0 ignored issues
show
Bug introduced by
The property container does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
15
    }
16
17
    public function index(Request $request, Response $response)
18
    {
19
        $username = $this->container['config']->get('database.drivers.mysql.username');
20
21
        ob_start();
22
        include VIEWS.'settings.php';
23
        $view = ob_get_contents();
24
        ob_end_clean();
25
26
        $response->write($view);
27
28
        return $response;
29
    }
30
}
31