GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Sqlserver::connect()   A
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
nc 4
nop 1
dl 0
loc 15
rs 9.4555
c 0
b 0
f 0
1
<?php
2
/**
3
 * Database
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\Pdo;
10
11
/**
12
 * Connection management to SQL Server
13
 *
14
 * @package Database
15
 * @author  Gjero Krsteski <[email protected]>
16
 */
17
class Sqlserver extends Connector
18
{
19
    protected $options = array(
20
        \PDO::ATTR_CASE              => \PDO::CASE_LOWER,
21
        \PDO::ATTR_ERRMODE           => \PDO::ERRMODE_EXCEPTION,
22
        \PDO::ATTR_ORACLE_NULLS      => \PDO::NULL_NATURAL,
23
        \PDO::ATTR_STRINGIFY_FETCHES => false,
24
    );
25
26
    /**
27
     * @param array $config
28
     *
29
     * @return \Pimf\Database
30
     */
31
    public function connect(array $config)
32
    {
33
        // This connection string format can also be used to connect
34
        // to Azure SQL Server databases.
35
        $port = (isset($config['port'])) ? ',' . $config['port'] : '';
36
37
        //check for dblib for mac users connecting to mssql
38
        if (isset($config['dsn_type']) && !empty($config['dsn_type']) && $config['dsn_type'] == 'dblib') {
39
            $dsn = "dblib:host={$config['host']}{$port};dbname={$config['database']}";
40
        } else {
41
            $dsn = "sqlsrv:Server={$config['host']}{$port};Database={$config['database']}";
42
        }
43
44
        return new \Pimf\Database($dsn, $config['username'], $config['password'], $this->options($config));
45
    }
46
}
47