| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 47 | public static function getInstance(): ?\PDO |
||
| 48 | { |
||
| 49 | if (empty(self::$instance)) { |
||
| 50 | try { |
||
| 51 | $config = self::getConfig(); |
||
| 52 | self::$instance = new \PDO( |
||
| 53 | "{$config->driver}:host={$config->host};dbname={$config->name};port={$config->port}", |
||
| 54 | $config->user, |
||
| 55 | $config->password, |
||
| 56 | self::OPTIONS |
||
| 57 | ); |
||
| 58 | |||
| 59 | } catch (\PDOException $exception) { |
||
| 60 | return null; |
||
| 61 | } |
||
| 62 | |||
| 63 | } |
||
| 64 | return self::$instance; |
||
| 65 | } |
||
| 83 | } |