| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | public function __construct( |
||
| 23 | string $host, |
||
| 24 | int $port, |
||
| 25 | string $database, |
||
| 26 | string $username, |
||
| 27 | string $password, |
||
| 28 | string $charset = null, |
||
| 29 | array $options = [] |
||
| 30 | ) { |
||
| 31 | $dsn = "mysql:host={$host};port={$port};dbname={$database}"; |
||
| 32 | |||
| 33 | if (isset($charset)) { |
||
| 34 | $dsn .= ";charset={$charset}"; |
||
| 35 | } |
||
| 36 | |||
| 37 | $this->dsn = $dsn; |
||
| 38 | $this->host = $host; |
||
| 39 | $this->port = $port; |
||
| 40 | $this->username = $username; |
||
| 41 | $this->password = $password; |
||
| 42 | $this->options = array_merge($this->options, $options); |
||
| 43 | } |
||
| 45 |