Total Complexity | 2 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | final class MssqlDsn |
||
8 | { |
||
9 | private ?string $database; |
||
10 | private string $driver; |
||
11 | private string $dsn; |
||
12 | private ?string $server; |
||
13 | private ?string $port; |
||
14 | |||
15 | public function __construct(string $driver, string $server, string $database, string $port = '1433') |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * @return string the Data Source Name, or DSN, contains the information required to connect to the database. |
||
25 | * Please refer to the [PHP manual](http://php.net/manual/en/pdo.construct.php) on the format of the DSN string. |
||
26 | * |
||
27 | * The `driver` array key is used as the driver prefix of the DSN, all further key-value pairs are rendered as |
||
28 | * `key=value` and concatenated by `;`. For example: |
||
29 | * |
||
30 | * ```php |
||
31 | * $dsn = new MssqlDsn('sqlsrv', 'localhost', 'yiitest', '1433'); |
||
32 | * $connection = new MssqlConnection($this->cache, $this->logger, $this->profiler, $dsn->getDsn()); |
||
33 | * ``` |
||
34 | * |
||
35 | * Will result in the DSN string `sqlsrv:Server=localhost,1433;Database=yiitest`. |
||
36 | */ |
||
37 | |||
38 | public function getDsn(): string |
||
45 |