Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
48 | public function __construct(string $dsn, string $username=NULL, string $password=NULL, array $options=[]) |
||
49 | { |
||
50 | // Set the charset to UTF-8 |
||
51 | if (\defined('\\PDO::MYSQL_ATTR_INIT_COMMAND')) |
||
52 | { |
||
53 | $options = array_merge($options, [ |
||
54 | PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES UTF-8 COLLATE 'UTF-8'", |
||
55 | ]); |
||
56 | } |
||
57 | |||
58 | if (strpos($dsn, 'mysql') === FALSE) |
||
59 | { |
||
60 | $dsn = 'mysql:'.$dsn; |
||
61 | } |
||
62 | |||
63 | parent::__construct($dsn, $username, $password, $options); |
||
64 | } |
||
65 | } |