Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 11.76% |
Changes | 0 |
1 | <?php |
||
10 | class DB2Driver extends AbstractDB2Driver |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritdoc} |
||
14 | */ |
||
15 | public function connect(array $params, $username = null, $password = null, array $driverOptions = []) |
||
16 | { |
||
17 | if (! isset($params['protocol'])) { |
||
18 | $params['protocol'] = 'TCPIP'; |
||
19 | } |
||
20 | |||
21 | if ($params['host'] !== 'localhost' && $params['host'] !== '127.0.0.1') { |
||
22 | // if the host isn't localhost, use extended connection params |
||
23 | $params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' . |
||
24 | ';DATABASE=' . $params['dbname'] . |
||
25 | ';HOSTNAME=' . $params['host'] . |
||
26 | ';PROTOCOL=' . $params['protocol'] . |
||
27 | ';UID=' . $username . |
||
28 | ';PWD=' . $password . ';'; |
||
29 | if (isset($params['port'])) { |
||
30 | $params['dbname'] .= 'PORT=' . $params['port']; |
||
31 | } |
||
32 | |||
33 | $username = null; |
||
34 | $password = null; |
||
35 | } |
||
36 | |||
37 | return new DB2Connection($params, (string) $username, (string) $password, $driverOptions); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | * |
||
43 | * @deprecated |
||
44 | */ |
||
45 | 22 | public function getName() |
|
48 | } |
||
49 | } |
||
50 |