Total Complexity | 4 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | class DsnConnectionConfig extends ConnectionConfig implements ProvidesSourceString |
||
18 | { |
||
19 | /** |
||
20 | * @var string|null |
||
21 | */ |
||
22 | private ?string $database = null; |
||
23 | |||
24 | /** |
||
25 | * @var non-empty-string |
||
|
|||
26 | * @psalm-allow-private-mutation |
||
27 | */ |
||
28 | public string $dsn; |
||
29 | |||
30 | /** |
||
31 | * @param non-empty-string|\Stringable $dsn |
||
32 | * @param non-empty-string|null $user |
||
33 | * @param non-empty-string|null $password |
||
34 | * @param array $options |
||
35 | */ |
||
36 | public function __construct( |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * {@inheritDoc} |
||
50 | */ |
||
51 | public function getSourceString(): string |
||
52 | { |
||
53 | /** @psalm-suppress ArgumentTypeCoercion */ |
||
54 | return $this->database ??= DataSourceName::read($this->getDsn(), 'dbname') ?? '*'; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | public function getDsn(): string |
||
63 | } |
||
64 | |||
65 | public static function __set_state(array $state): self |
||
70 |