Total Complexity | 6 |
Total Lines | 70 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Mysql extends SQL |
||
8 | { |
||
9 | const DEFAULT_HOST = '127.0.0.1'; |
||
10 | const DEFAULT_PORT = '3306'; |
||
11 | const DEFAULT_CHARSET = 'utf8'; |
||
12 | const DEFAULT_COLLATION = 'utf8_unicode_ci'; |
||
13 | |||
14 | /** |
||
15 | * @link https://secure.php.net/manual/en/ref.pdo-mysql.connection.php |
||
16 | * |
||
17 | * The PDO_MYSQL Data Source Name (DSN) is composed of the following elements: |
||
18 | */ |
||
19 | const AVAILABLE_ELEMENTS = [ |
||
20 | 'host', |
||
21 | 'port', |
||
22 | 'dbname', |
||
23 | 'unix_socket' |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * Generate DSN by parameters in config |
||
28 | * |
||
29 | * @param array $config |
||
30 | * @return string |
||
31 | */ |
||
32 | public function genDsn($config): string |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Initiate connection to database |
||
46 | * |
||
47 | * @return DriverInterface |
||
48 | */ |
||
49 | public function connect(): DriverInterface |
||
65 | } |
||
66 | |||
67 | private function getOptions(): array |
||
80 |