Passed
Push — master ( c5754d...f173b7 )
by Darío
05:12
created

Authentication::connect()   B

Complexity

Conditions 7
Paths 7

Size

Total Lines 27
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 19
nc 7
nop 1
dl 0
loc 27
rs 8.8333
c 0
b 0
f 0
1
<?php
2
3
namespace Connections\Model;
4
5
use Drone\Db\TableGateway\TableGateway;
6
7
class Authentication extends TableGateway
8
{
9
    public function connect($dbconfig)
10
    {
11
        $db = $this->getDriver()->getDb();
12
13
        foreach ($dbconfig as $key => $value)
14
        {
15
        	switch ($key)
16
        	{
17
        		case 'dbhost':
18
        			$db->setDbhost($value);
19
        			break;
20
        		case 'dbuser':
21
        			$db->setDbuser($value);
22
        			break;
23
        		case 'dbpass':
24
        			$db->setDbpass($value);
25
        			break;
26
        		case 'dbname':
27
        			$db->setDbname($value);
28
        			break;
29
        		case 'dbchar':
30
        			$db->setDbChar($value);
31
        			break;
32
        	}
33
        }
34
35
        return $db->reconnect();
36
    }
37
}