Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function index(Request $request, Response $response) |
||
18 | { |
||
19 | $driver = $this->container['config']->get('database.driver'); |
||
20 | $host = $this->container['config']->get('database.drivers.mysql.host'); |
||
21 | $database = $this->container['config']->get('database.drivers.mysql.database'); |
||
22 | $username = $this->container['config']->get('database.drivers.mysql.username'); |
||
23 | $password = $this->container['config']->get('database.drivers.mysql.password'); |
||
24 | |||
25 | if (!testDatabaseConnectivity($driver, $host, $database, $username, $password)) { |
||
26 | return $response->withHeader('Location', resolveRoute('setup')); |
||
27 | } |
||
28 | |||
29 | $username = $this->container['config']->get('database.drivers.mysql.username'); |
||
30 | |||
31 | ob_start(); |
||
32 | include VIEWS.'index.php'; |
||
33 | $view = ob_get_contents(); |
||
34 | ob_end_clean(); |
||
35 | |||
36 | $response->write($view); |
||
37 | |||
38 | return $response; |
||
39 | } |
||
40 | } |
||
41 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: