MSSQLConfiguration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cozy\Database\Relational\Configuration;
6
7
class MSSQLConfiguration implements ConfigurationInterface
8
{
9
    use TCPConfigurationTrait;
0 ignored issues
show
Bug introduced by
The trait Cozy\Database\Relational...n\TCPConfigurationTrait requires the property $errorInfo which is not provided by Cozy\Database\Relational...tion\MSSQLConfiguration.
Loading history...
10
11
    /**
12
     *  Creates a configuration set representing a connection to a database.
13
     *
14
     * @param string $host The hostname on which the database server resides.
15
     * @param int $port The port number where the database server is listening (default is 1433).
16
     * @param string $database The name of the database.
17
     * @param string $username The user name for the DSN string. This parameter is optional for some PDO drivers.
18
     * @param string $password The password for the DSN string. This parameter is optional for some PDO drivers.
19
     * @param array $options A key=>value array of PDO driver-specific connection options.
20
     */
21
    public function __construct(
22
        string $host,
23
        int $port,
24
        string $database,
25
        string $username,
26
        string $password,
27
        array $options = []
28
    ) {
29
        $this->dsn = "sqlsrv:Server={$host},{$port};Database={$database};LoginTimeout=1;QuotedId=1";
30
        $this->host = $host;
31
        $this->port = $port;
32
        $this->username = $username;
33
        $this->password = $password;
34
        $this->options = array_merge($this->options, $options);
35
    }
36
}
37