| Total Complexity | 5 |
| Total Lines | 68 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class LazyPDO |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | private $dsn; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var string |
||
| 18 | */ |
||
| 19 | private $username; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | private $password; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var array |
||
| 28 | */ |
||
| 29 | private $options; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var \PDO |
||
| 33 | */ |
||
| 34 | private $pdo; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $dsn |
||
| 38 | * @param string $username |
||
| 39 | * @param string $password |
||
| 40 | * @param array $options |
||
| 41 | */ |
||
| 42 | public function __construct(string $dsn, string $username = '', string $password = '', array $options = []) |
||
| 43 | { |
||
| 44 | $this->changeConnection($dsn, $username, $password, $options); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $dsn |
||
| 49 | * @param string $username |
||
| 50 | * @param string $password |
||
| 51 | * @param array $options |
||
| 52 | */ |
||
| 53 | public function changeConnection(string $dsn, string $username = '', string $password = '', array $options = []) |
||
| 54 | { |
||
| 55 | $this->dsn = $dsn; |
||
| 56 | $this->username = $username; |
||
| 57 | $this->password = $password; |
||
| 58 | $this->options = $options; |
||
| 59 | $this->pdo = null; |
||
| 60 | } |
||
| 61 | |||
| 62 | public function __call($name, $arguments) |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return \PDO |
||
| 69 | */ |
||
| 70 | private function pdo(): \PDO |
||
| 77 | } |
||
| 78 | } |