ConnectionConfigUrl   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 6
1
<?php declare(strict_types=1);
2
3
namespace Janisbiz\LightOrm\Dms\MySQL\Connection;
4
5
class ConnectionConfigUrl extends ConnectionConfig
6
{
7
    /**
8
     * @param string $url
9
     */
10
    public function __construct(string $url)
11
    {
12
        $urlParts = \parse_url($url);
13
14
        parent::__construct(
15
            isset($urlParts['host']) ? $urlParts['host'] : '',
16
            isset($urlParts['user']) ? $urlParts['user'] : '',
17
            isset($urlParts['pass']) ? $urlParts['pass'] : '',
18
            isset($urlParts['path']) ? ltrim($urlParts['path'], '/') : '',
19
            isset($urlParts['port']) ? $urlParts['port'] : 3306
20
        );
21
    }
22
}
23