JDBC   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A url() 0 20 4
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: vernerd
5
 * Date: 2019-09-23
6
 * Time: 19:38.
7
 */
8
9
namespace DanielWerner\LaravelSchemaCrawler;
10
11
class JDBC
12
{
13
    /**
14
     * @param string $databaseDriver
15
     * @param string $server
16
     * @param string $port
17
     * @return string
18
     */
19
    public static function url(string $databaseDriver, string $server, string $port): string
20
    {
21
        $url = '';
22
23
        switch ($databaseDriver) {
24
            case 'mysql':
25
                $url = 'jdbc:mysql://%s:%d?serverTimezone=UTC';
26
                break;
27
            case 'pgsql':
28
                $url = 'jdbc:postgresql://%s:%d?serverTimezone=UTC';
29
                break;
30
            case 'sqlsrv':
31
                $url = 'jdbc:sqlserver://%s:%d?serverTimezone=UTC';
32
                break;
33
        }
34
35
        $url = sprintf($url, $server, $port);
36
37
        return $url;
38
    }
39
}
40