Passed
Push — master ( db71b9...272130 )
by Darío
04:27
created

GatewayAdapter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
1
<?php
2
3
namespace Auth\Model;
4
5
use Drone\Db\TableGateway\TableGateway;
6
use Drone\Db\Entity;
7
8
class GatewayAdapter extends TableGateway
9
{
10
    /**
11
     * Constructor
12
     *
13
     * @return null
14
     */
15
    public function __construct(Entity $entity)
16
    {
17
        parent::__construct($entity, false);
18
19
        $this->getDriver()->getDb()->setDbUser($_COOKIE["username"]);
20
        $this->getDriver()->getDb()->setDbpass($_COOKIE["password"]);
21
22
        if (!$this->getDriver()->getDb()->connect())
23
        {
24
            $errors = $this->getDriver()->getDb()->getErrors();
25
            throw new \Exception(array_shift($errors));
26
        }
27
    }
28
}