| Total Complexity | 5 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 5 | enum DatabaseDriver: string |
||
| 6 | { |
||
| 7 | case MYSQL = 'mysql'; |
||
| 8 | case MARIADB = 'mariadb'; |
||
| 9 | case SQLITE = 'sqlite'; |
||
| 10 | case PGSQL = 'pgsql'; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Human friendly label for error/help messages. |
||
| 14 | * |
||
| 15 | * @return string |
||
| 16 | */ |
||
| 17 | public function label(): string |
||
| 18 | { |
||
| 19 | return match ($this) { |
||
| 20 | self::MYSQL => 'MySQL(mysql)', |
||
| 21 | self::MARIADB => 'MariaDB(mariadb)', |
||
| 22 | self::SQLITE => 'SQLite(sqlite)', |
||
| 23 | self::PGSQL => 'PgSQL(pgsql)', |
||
| 24 | }; |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * PDO DSN identifier for the driver. |
||
| 29 | * |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | public function dsnName(): string |
||
| 37 | }; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Whether the driver behaves like MySQL for SQL syntax decisions. |
||
| 42 | * |
||
| 43 | * @return bool |
||
| 44 | */ |
||
| 45 | public function isMysqlFamily(): bool |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Handy helper for building allow-list messages. |
||
| 52 | * |
||
| 53 | * @return array<int, string> |
||
| 54 | */ |
||
| 55 | public static function labels(): array |
||
| 61 |