Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
4 / 4 |
App\Models\DatabaseConnection | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
4 / 4 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
getDsn | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
namespace App\Models; | |
/** | |
* Description of DatabaseConnection | |
* | |
* @author lennartbinscheck | |
*/ | |
class DatabaseConnection { | |
/** | |
* | |
* @var DatabaseConfiguration | |
*/ | |
private $configuration; | |
/** | |
* | |
* @var string | |
*/ | |
private $dsn; | |
/** | |
* | |
* @param \App\Models\DatabaseConfiguration $config | |
*/ | |
public function __construct(DatabaseConfiguration $config) { | |
$this->configuration = $config; | |
$this->dsn = 'mysql:host=' . $this->configuration->getHost() . ';dbname=' . $this->configuration->getDatabaseName() . ';charset=utf8'; | |
} | |
/** | |
* | |
* @return string | |
*/ | |
public function getDsn() { | |
return $this->dsn; | |
} | |
} |