| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 5 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 9 | class Connection |
||
| 10 | { |
||
| 11 | private string $dsn; |
||
| 12 | private string $username; |
||
| 13 | private string $password; |
||
| 14 | |||
| 15 | /** @var array<string> */ |
||
| 16 | private array $options; |
||
| 17 | |||
| 18 | /** @var array<string> */ |
||
| 19 | private array $queries; |
||
| 20 | private ?ExtendedPdo $pdo = null; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @phpstan-param array<string> $options |
||
| 24 | * @phpstan-param array<string> $queries |
||
| 25 | */ |
||
| 26 | public function __construct( |
||
| 38 | } |
||
| 39 | |||
| 40 | public function __invoke(): ExtendedPdo |
||
| 41 | { |
||
| 42 | if ($this->pdo instanceof ExtendedPdo) { |
||
| 43 | return $this->pdo; |
||
| 44 | } |
||
| 45 | |||
| 46 | $this->pdo = new ExtendedPdo($this->dsn, $this->username, $this->password, $this->options, $this->queries); |
||
| 47 | |||
| 48 | 9 | return $this->pdo; |
|
|
|
|||
| 49 | } |
||
| 50 | 9 | ||
| 51 | 9 | public function isSame(string $dsn, string $username, string $password): bool |
|
| 56 | } |
||
| 57 | } |
||
| 58 |