| Total Complexity | 6 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 91.67% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | final class PDODriver extends AbstractPDODriver |
||
| 11 | { |
||
| 12 | 280 | public function createConnection(): PDO |
|
| 13 | { |
||
| 14 | 280 | $this->attributes += [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]; |
|
| 15 | |||
| 16 | 280 | if (PHP_VERSION_ID >= 80100) { |
|
| 17 | $this->attributes += [PDO::ATTR_STRINGIFY_FETCHES => true]; |
||
| 18 | } |
||
| 19 | |||
| 20 | 280 | $pdo = parent::createConnection(); |
|
| 21 | |||
| 22 | 280 | if ($this->charset !== null) { |
|
| 23 | 1 | $pdo->exec('SET NAMES ' . $pdo->quote($this->charset)); |
|
| 24 | } |
||
| 25 | |||
| 26 | 280 | if (!str_contains($this->dsn, 'charset') && $this->charset === null) { |
|
| 27 | 1 | $pdo->exec('SET NAMES ' . $pdo->quote('utf8mb4')); |
|
| 28 | } |
||
| 29 | |||
| 30 | 280 | return $pdo; |
|
| 31 | } |
||
| 32 | |||
| 33 | 374 | public function getDriverName(): string |
|
| 36 | } |
||
| 37 | } |
||
| 38 |